|
|
> https://docs.gitlab.com/ee/ci/lint
|
|
|
## 使用 CI Lint 工具验证 .gitlab-ci.yml 语法
|
|
|
|
|
|
Validate .gitlab-ci.yml syntax with the CI Lint tool
|
|
|
If you want to test the validity of your GitLab CI/CD configuration before committing the changes, you can use the CI Lint tool. This tool checks for syntax and logical errors by default, and can simulate pipeline creation to try to find more complicated issues as well.
|
|
|
如果要在提交更改之前测试 CI/CD 配置的有效性,可以使用 CI Lint 工具。默认情况下,此工具会检查语法和逻辑错误,并且可以模拟创建 Pipelines 以尝试查找更复杂的问题。
|
|
|
|
|
|
To access the CI Lint tool, navigate to CI/CD > Pipelines or CI/CD > Jobs in your project and click CI lint.
|
|
|
要访问 CI Lint 工具,请导航到项目中的 CI/CD > Pipelines 或 CI/CD > Jobs ,然后单击CI lint。
|
|
|
### 验证基本逻辑和语法
|
|
|
|
|
|
Validate basic logic and syntax
|
|
|
By default, the CI lint checks the syntax of your CI YAML configuration and also runs some basic logical validations. Configuration added with the includes keyword, is also validated.
|
|
|
|
|
|
To use the CI lint, paste a complete CI configuration (.gitlab-ci.yml for example) into the text box and click Validate:
|
|
|
默认情况下,CI lint 检查 CI YAML 配置的语法,并运行一些基本的逻辑验证。添加了`includes`关键字的配置也会进行验证。
|
|
|
|
|
|
CI Lint
|
|
|
要使用 CI Lint,请将完整的 CI 配置(例如 .gitlab-ci.yml)粘贴到文本框中,然后单击**验证**:
|
|
|
|
|
|
Pipeline simulation
|
|
|
Introduced in GitLab 13.3.
|
|
|
![CI Lint]()
|
|
|
### Pipeline 模拟
|
|
|
|
|
|
Not all pipeline configuration issues can be found by the basic CI lint validation. You can simulate the creation of a pipeline for deeper validation that can discover more complicated issues.
|
|
|
并非所有 Pipeline 配置问题都可以通过基本 CI Lint 验证工具找到。你可以模拟 Pipeline 的创建过程并进行更深入的验证,从而发现更复杂的问题。
|
|
|
|
|
|
To validate the configuration by running a pipeline simulation:
|
|
|
Pipeline 模拟验证配置文件的步骤如下:
|
|
|
|
|
|
Paste the GitLab CI configuration to verify into the text box.
|
|
|
Click the Simulate pipeline creation for the default branch checkbox.
|
|
|
Click Validate.
|
|
|
Dry run
|
|
|
|
|
|
Pipeline simulation limitations
|
|
|
Simulations run as git push events against the default branch. You must have permissions to create pipelines on this branch to validate with a simulation.
|
|
|
1. 将要验证的 CI 配置粘贴到文本框中
|
|
|
2. 单击 模拟创建默认分支 Pipeline 复选框
|
|
|
3. 单击验证
|
|
|
|
|
|
#### Pipeline 模拟限制
|
|
|
|
|
|
Pipeline 模拟是通过针对默认分支的 git push 进行,因此你必须[有权](/docs/user/permissions)在此分支上创建 Pipeline 才能使用模拟进行验证。 |
|
|
\ No newline at end of file |