Validate the .gitlab-ci.yml
(API)
Validate the .gitlab-ci.yml
(API)
在 GitLab 8.12 中引入 .
检查您的.gitlab-ci.yml
文件是否有效.
POST /ci/lint
Attribute | Type | Required | Description |
---|---|---|---|
content |
string | yes | the .gitlab-ci.yaml content |
curl --header "Content-Type: application/json" "https://gitlab.example.com/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\"]}}"}'
请务必复制并粘贴.gitlab-ci.yml
的确切内容,因为 YAML 对于缩进和空格非常挑剔.
响应示例:
有效内容:
{ "status": "valid", "errors": [] }
无效的内容:
{ "status": "invalid", "errors": [ "variables config should be a hash of key value pairs" ] }
没有 content 属性:
{ "error": "content is missing" }