diff options
Diffstat (limited to 'doc/api/lint.md')
-rw-r--r-- | doc/api/lint.md | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/doc/api/lint.md b/doc/api/lint.md index 32318b9955d..9e29e8dccb4 100644 --- a/doc/api/lint.md +++ b/doc/api/lint.md @@ -102,160 +102,6 @@ Example responses: } ``` -<!--- start_remove The following content will be removed on remove_date: '2023-08-22' --> - -## Validate the CI YAML configuration (deprecated) - -WARNING: -This endpoint was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/381669) in GitLab 15.7 -and was [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/403256) in 16.0. Use [`POST /projects/:id/ci/lint`](#validate-the-cicd-configuration-for-a-namespace) instead. - -Checks if CI/CD YAML configuration is valid. This endpoint validates basic CI/CD -configuration syntax. It doesn't have any namespace-specific context. - -Access to this endpoint does not require authentication when the instance -[allows new sign ups](../administration/settings/sign_up_restrictions.md#disable-new-sign-ups) -and: - -- Does not have an [allowlist or denylist](../administration/settings/sign_up_restrictions.md#allow-or-deny-sign-ups-using-specific-email-domains). -- Does not [require administrator approval for new sign ups](../administration/settings/sign_up_restrictions.md#require-administrator-approval-for-new-sign-ups). -- Does not have additional [sign up restrictions](../administration/settings/sign_up_restrictions.md). - -Otherwise, authentication is required. - -```plaintext -POST /ci/lint -``` - -| Attribute | Type | Required | Description | -|-----------------------|---------|----------|-------------| -| `content` | string | Yes | The CI/CD configuration content. | -| `include_merged_yaml` | boolean | No | If the [expanded CI/CD configuration](#yaml-expansion) should be included in the response. | -| `include_jobs` | boolean | No | If the list of jobs should be included in the response. Default: `false`. | - -```shell -curl --header "Content-Type: application/json" --header "PRIVATE-TOKEN: <your_access_token>" "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\"]}}"}' -``` - -Be sure to paste the exact contents of your GitLab CI/CD YAML configuration because YAML -is very sensitive about indentation and spacing. - -Example responses: - -- Valid content: - - ```json - { - "status": "valid", - "errors": [], - "warnings": [] - } - ``` - -- Valid content with warnings: - - ```json - { - "status": "valid", - "errors": [], - "warnings": ["jobs:job may allow multiple pipelines to run for a single action due to - `rules:when` clause with no `workflow:rules` - read more: - https://docs.gitlab.com/ee/ci/troubleshooting.html#pipeline-warnings"] - } - ``` - -- Invalid content: - - ```json - { - "status": "invalid", - "errors": [ - "variables config should be a hash of key value pairs" - ], - "warnings": [] - } - ``` - -- Without the content attribute: - - ```json - { - "error": "content is missing" - } - ``` - -### YAML expansion - -The CI lint returns an expanded version of the configuration. The expansion does not -work for CI configuration added with [`include: local`](../ci/yaml/index.md#includelocal), -and the [`extends:`](../ci/yaml/index.md#extends) keyword is [not fully supported](https://gitlab.com/gitlab-org/gitlab/-/issues/258843). - -Example contents of a `.gitlab-ci.yml` passed to the CI Lint API with -`include_merged_yaml` and `include_jobs` set as true: - -```yaml -include: - remote: 'https://example.com/remote.yaml' - -test: - stage: test - script: - - echo 1 -``` - -Example contents of `https://example.com/remote.yaml`: - -```yaml -another_test: - stage: test - script: - - echo 2 -``` - -Example response: - -```json -{ - "status": "valid", - "errors": [], - "merged_yaml": "---\n:another_test:\n :stage: test\n :script: echo 2\n:test:\n :stage: test\n :script: echo 1\n", - "jobs": [ - { - "name":"test", - "stage":"test", - "before_script":[], - "script":["echo 1"], - "after_script":[], - "tag_list":[], - "environment":null, - "when":"on_success", - "allow_failure":false, - "only":{ - "refs":["branches","tags"] - }, - "except":null - }, - { - "name":"another_test", - "stage":"test", - "before_script":[], - "script":["echo 2"], - "after_script":[], - "tag_list":[], - "environment":null, - "when":"on_success", - "allow_failure":false, - "only":{ - "refs":["branches","tags"] - }, - "except":null - } - ] -} -``` - -<!--- end_remove --> - ## Use jq to create and process YAML & JSON payloads To `POST` a YAML configuration to the CI Lint endpoint, it must be properly escaped and JSON encoded. |