を検証します。.gitlab-ci.yml (API)

GitLab 8.12で導入されました

.gitlab-ci.yml ファイルが有効かどうかをチェックします。

POST /ci/lint
属性 タイプ 必須 説明
content はい .gitlab-ci.yaml コンテンツ
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\"]}}"}'

YAML はインデントとスペースにとてもうるさいので、.gitlab-ci.yml の内容を正確にコピーペーストしてください。

回答例

  • 有効なコンテンツ

     {
       "status": "valid",
       "errors": []
     }
    
  • 無効なコンテンツです:

     {
       "status": "invalid",
       "errors": [
         "variables config should be a hash of key value pairs"
       ]
     }
    
  • content属性がない場合:

     {
       "error": "content is missing"
     }