是否可以迭代 jenkins 作业构建器作业模板?

时间:2021-01-13 16:17:39

标签: python jenkins yaml jenkins-job-builder

我正在评估 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}'

是否可以将 redisnginx 作业放在 {dev,staging,prod}/{deploy,provision} 文件夹中而无需更改

jobs:
- '{job_name}'

注意:我知道我可以使用 display-name 作为自定义名称,但我的其他参数取决于作业名称。

感谢任何帮助。

0 个答案:

没有答案
相关问题