diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-11 15:08:46 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-11 15:08:46 +0000 |
commit | 5fc3c77e2b08746bd39bfffae0c5918d63178433 (patch) | |
tree | f6d8d49f2caa07da9c09dc3333849b4c39cc857d /doc/api | |
parent | 9517d0eb2ca8bde02d7fae2173e0a43b67b2b9f5 (diff) | |
download | gitlab-ce-5fc3c77e2b08746bd39bfffae0c5918d63178433.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/api')
-rw-r--r-- | doc/api/lint.md | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/doc/api/lint.md b/doc/api/lint.md index c82e0845f99..a1e68e70b8a 100644 --- a/doc/api/lint.md +++ b/doc/api/lint.md @@ -99,6 +99,54 @@ Example response: } ``` +## Validate a CI YAML configuration with a namespace + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/231352) in GitLab 13.6. + +Checks if CI/CD YAML configuration is valid. This endpoint has namespace +specific context. + +```plaintext +POST /projects/:id/ci/lint +``` + +| Attribute | Type | Required | Description | +| ---------- | ------- | -------- | -------- | +| `content` | string | yes | The CI/CD configuration content. | +| `dry_run` | boolean | no | Run [pipeline creation simulation](../ci/lint.md#pipeline-simulation), or only do static check. This is false by default. | + +Example request: + +```shell +curl --header "Content-Type: application/json" "https://gitlab.example.com/api/v4/projects/:id/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\"]}}"}' +``` + +Example responses: + +- Valid configuration: + + ```json + { + "valid": true, + "merged_yaml": "---\n:test_job:\n :script: echo 1\n", + "errors": [], + "warnings": [] + } + ``` + +- Invalid configuration: + + ```json + { + "valid": false, + "merged_yaml": "---\n:test_job:\n :script: echo 1\n", + "errors": [ + "jobs config should contain at least one visible job" + ], + "warnings": [] + } + ``` + ## Validate a project's CI configuration > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/231352) in GitLab 13.5. |