Commit 292cdb4c authored by Marcel Amirault's avatar Marcel Amirault Committed by Andrew Fontaine

CTRT revamp of the CI lint doc

parent f0df15eb
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
%h4.pt-3.pb-3= _("Validate your GitLab CI configuration") %h4.pt-3.pb-3= _("Validate your GitLab CI configuration")
#js-ci-lint{ data: { endpoint: project_ci_lint_path(@project), pipeline_simulation_help_page_path: help_page_path('ci/lint', anchor: 'pipeline-simulation') , lint_help_page_path: help_page_path('ci/lint', anchor: 'validate-basic-logic-and-syntax') } } #js-ci-lint{ data: { endpoint: project_ci_lint_path(@project), pipeline_simulation_help_page_path: help_page_path('ci/lint', anchor: 'simulate-a-pipeline') , lint_help_page_path: help_page_path('ci/lint', anchor: 'check-cicd-syntax') } }
...@@ -169,7 +169,7 @@ POST /projects/:id/ci/lint ...@@ -169,7 +169,7 @@ POST /projects/:id/ci/lint
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
| ---------- | ------- | -------- | -------- | | ---------- | ------- | -------- | -------- |
| `content` | string | yes | The CI/CD configuration content. | | `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. | | `dry_run` | boolean | no | Run [pipeline creation simulation](../ci/lint.md#simulate-a-pipeline), or only do static check. This is false by default. |
| `include_jobs` | boolean | no | If the list of jobs that would exist in a static check or pipeline simulation should be included in the response. This is false by default. | | `include_jobs` | boolean | no | If the list of jobs that would exist in a static check or pipeline simulation should be included in the response. This is false by default. |
Example request: Example request:
......
...@@ -4,48 +4,54 @@ group: Pipeline Authoring ...@@ -4,48 +4,54 @@ group: Pipeline Authoring
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
--- ---
# Validate `.gitlab-ci.yml` syntax with the CI Lint tool **(FREE)** # Validate GitLab CI/CD configuration **(FREE)**
If you want to test the validity of your GitLab CI/CD configuration before committing Use the CI Lint tool to check the validity of GitLab CI/CD configuration.
the changes, you can use the CI Lint tool. This tool checks for syntax and logical You can validate the syntax from a `.gitlab-ci.yml` file or any other sample CI/CD configuration.
errors by default, and can simulate pipeline creation to try to find more complicated This tool checks for syntax and logic errors, and can simulate pipeline
issues as well. creation to try to find more complicated configuration problems.
To access the CI Lint tool, navigate to **CI/CD > Pipelines** or **CI/CD > Jobs** If you use the [pipeline editor](pipeline_editor/index.md), it verifies configuration
in your project and click **CI lint**. syntax automatically.
If you use VS Code, you can also validate your CI/CD configuration with the If you use VS Code, you can validate your CI/CD configuration with the
[GitLab Workflow VS Code extension](../user/project/repository/vscode.md). [GitLab Workflow VS Code extension](../user/project/repository/vscode.md).
## Validate basic logic and syntax ## Check CI/CD syntax
By default, the CI lint checks the syntax of your CI YAML configuration and also runs The CI lint tool checks the syntax of GitLab CI/CD configuration, including
some basic logical validations. Configuration added with the [`includes` keyword](yaml/index.md#include), configuration added with the [`includes` keyword](yaml/index.md#include).
is also validated.
To use the CI lint, paste a complete CI configuration (`.gitlab-ci.yml` for example) To check CI/CD configuration with the CI lint tool:
into the text box and click **Validate**:
![CI Lint](img/ci_lint.png) 1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select one of:
- **CI/CD > Pipelines**
- **CI/CD > Jobs**
1. In the top right, select **CI lint**.
1. Paste a copy of the CI/CD configuration you want to check into the text box.
1. Select **Validate**.
## Pipeline simulation ## Simulate a pipeline
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/229794) in GitLab 13.3. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/229794) in GitLab 13.3.
Not all pipeline configuration issues can be found by the [basic CI lint validation](#validate-basic-logic-and-syntax). You can simulate the creation of a GitLab CI/CD pipeline to find more complicated issues,
You can simulate the creation of a pipeline for deeper validation that can discover including problems with [`needs`](yaml/index.md#needs) and [`rules`](yaml/index.md#rules)
more complicated issues. configuration. A simulation runs as a Git `push` event on the default branch.
To validate the configuration by running a pipeline simulation:
1. Paste the GitLab CI configuration to verify into the text box. Prerequisites:
1. Select the **Simulate pipeline creation for the default branch** checkbox.
1. Select **Validate**.
![Dry run](img/ci_lint_dry_run.png) - You must have [permissions](../user/permissions.md#project-members-permissions)
to create pipelines on this branch to validate with a simulation.
### Pipeline simulation limitations To simulate a pipeline:
Simulations run as `git push` events against the default branch. You must have 1. On the top bar, select **Menu > Projects** and find your project.
[permissions](../user/permissions.md#project-members-permissions) to create pipelines 1. On the left sidebar, select one of:
on this branch to validate with a simulation. - **CI/CD > Pipelines**
- **CI/CD > Jobs**
1. In the top right, select **CI lint**.
1. Paste a copy of the CI/CD configuration you want to check into the text box.
1. Select **Simulate pipeline creation for the default branch**.
1. Select **Validate**.
...@@ -36,7 +36,7 @@ file is correct. Paste in full `.gitlab-ci.yml` files or individual jobs configu ...@@ -36,7 +36,7 @@ file is correct. Paste in full `.gitlab-ci.yml` files or individual jobs configu
to verify the basic syntax. to verify the basic syntax.
When a `.gitlab-ci.yml` file is present in a project, you can also use the CI Lint When a `.gitlab-ci.yml` file is present in a project, you can also use the CI Lint
tool to [simulate the creation of a full pipeline](lint.md#pipeline-simulation). tool to [simulate the creation of a full pipeline](lint.md#simulate-a-pipeline).
It does deeper verification of the configuration syntax. It does deeper verification of the configuration syntax.
## Verify variables ## Verify variables
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment