Skip to content
代码片段 群组 项目
未验证 提交 768d93ee 编辑于 作者: Lysanne Pinto's avatar Lysanne Pinto 提交者: GitLab
浏览文件

Merge branch 'docs-component-job-name-recommendation' into 'master'

Add best practice for job names

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/156622



Merged-by: default avatarLysanne Pinto <lpinto@gitlab.com>
Approved-by: default avatarLaura Montemayor <lmontemayor@gitlab.com>
Approved-by: default avatarDov Hershkovitch <dhershkovitch@gitlab.com>
Approved-by: default avatarLysanne Pinto <lpinto@gitlab.com>
Reviewed-by: default avatarMarcel Amirault <mamirault@gitlab.com>
Co-authored-by: default avatarMarcel Amirault <mamirault@gitlab.com>
No related branches found
No related tags found
无相关合并请求
......@@ -447,6 +447,38 @@ For example, to create a component with `stage` configuration that can be define
stage: verify
```
#### Define job names with inputs
Similar to the values for the `stage` keyword, you should avoid hard-coding job names
in CI/CD components. When your component's users can customize job names, they can prevent conflicts
with the existing names in their pipelines. Users could also include a component
multiple times with different input options by using different names.
Use `inputs` to allow your component's users to define a specific job name, or a prefix for the
job name. For example:
```yaml
spec:
inputs:
job-prefix:
description: "Define a prefix for the job name"
job-name:
description: "Alternatively, define the job's name"
job-stage:
default: test
---
"$[[ inputs.job-prefix ]]-scan-website":
stage: $[[ inputs.job-stage ]]
script:
- scan-website-1
"$[[ inputs.job-name ]]":
stage: $[[ inputs.job-stage ]]
script:
- scan-website-2
```
### Replace custom CI/CD variables with inputs
When using CI/CD variables in a component, evaluate if the `inputs` keyword
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册