从周一开始,我无法使用 gitlab 的 lint CI API,该 API 已记录在此处https://docs.gitlab.com/ee/api/lint.html#validate-the-ci-yaml-configuration https://docs.gitlab.com/ee/api/lint.html#validate-the-ci-yaml-configuration
我正在开发一个自托管的 gitlab,我们将 gitlab 更新到了最新版本(13.8.4)。
他们提到,我注意到文档在 13.8 和 13.9 之间发生了变化
访问此端点需要进行身份验证。
所以我尝试生成具有完全访问权限的个人访问令牌(我是管理员),但我仍然得到 401。
这是我的尝试:
$ curl --header "Content-Type: application/json" --header "PRIVATE-TOKEN: P3r50Na1t0k3N" "https://my-domain.artips.fr/api/v4/ci/lint" --data '{"content": "{ \"image\": \"ruby:2.6\", \"services\": [\"postgres\"], \"before_script\": [\"bundle install\", \"bundle exec rake db:create\"], \"variables\": {\"DB_NAME\": \"postgres\"}, \"types\": [\"test\", \"deploy\", \"notify\"], \"rspec\": { \"script\": \"rake spec\", \"tags\": [\"ruby\", \"postgres\"], \"only\": [\"branches\"]}}"}'
# Result : {"message":"401 Unauthorized"}
# Other try
$ curl -X POST --header "Content-Type: application/json" --header "PRIVATE-TOKEN: P3r50Na1t0k3N" "https:///my-domain.artips.fr/api/v4/ci/lint" --data '{"content": "{ \"image\": \"ruby:2.6\", \"services\": [\"postgres\"], \"before_script\": [\"bundle install\", \"bundle exec rake db:create\"], \"variables\": {\"DB_NAME\": \"postgres\"}, \"types\": [\"test\", \"deploy\", \"notify\"], \"rspec\": { \"script\": \"rake spec\", \"tags\": [\"ruby\", \"postgres\"], \"only\": [\"branches\"]}}"}'
# same result: {"message":"401 Unauthorized"}
有人遇到同样的问题吗?
提前致谢
Takeshi