我正在评估 jenkins 作业生成器以实现 jenkins 作业创建的自动化。但现在我遇到了一个死胡同,即将一项工作模板化到多个文件夹。
- job-template:
name: '{env}-{operation}-{job_name}'
project-type: pipeline
pipeline-scm:
scm:
- git:
url: '{repo_url}'
branches:
- '${{branch_or_tag}}'
clean: true
wipe-workspace: true
script-path: '{script_path}'
lightweight-checkout: true
- project:
name: helm-deploy
env:
- dev-test
- staging-test
- prod-test
operation:
- deploy
- provision
job_name:
- redis:
repo_url: https://github.com/project-sunbird/sunbird-kp.git
script_path: kubernetes/pipelines/deploy_redis/Jenkinsfile
- nginx:
repo_url: https://github.com/project-sunbird/sunbird-devops.git
script_path: kubernetes/pipelines/deploy_helm/Jenkinsfile
jobs:
- '{env}-{operation}-{job_name}'
是否可以将 redis
和 nginx
作业放在 {dev,staging,prod}/{deploy,provision} 文件夹中而无需更改
jobs:
- '{job_name}'
注意:我知道我可以使用 display-name
作为自定义名称,但我的其他参数取决于作业名称。
感谢任何帮助。