简体   繁体   English

Jenkins Job Builder 中的多项工作

[英]Multijob in Jenkins Job Builder

This is my first post here.这是我在这里的第一篇文章。 I am a newbie in YAML and a beginners in Jenkins. I have a requirement where I have to create a multijob project using Jenkins Job builders where project names I want to store as a variable.我是 YAML 的新手和 Jenkins 的初学者。我有一个要求,我必须使用 Jenkins Job builders 创建一个多作业multijob project ,我想将project names存储为变量。 so the intention is explained below:所以意图解释如下:

Job definition of Multijob Project:多任务项目的任务定义:

job:
  name: test_job
  project-type: multijob
  builders:
    - multijob:
        name: PhaseOne
        condition: SUCCESSFUL
        projects:
          - name: PhaseOneJobA
            current-parameters: true
            git-revision: true
          - name: PhaseOneJobB
            current-parameters: true
            property-file: build.props

I want to store following part in a List variable let's say: JobsList我想将以下部分存储在 List 变量中,比方说: JobsList

          - name: PhaseOneJobA
            current-parameters: true
          - name: PhaseOneJobB
            current-parameters: true

as作为

 jobsList:
          - name: {list}
            current-parameters: true

where list is列表在哪里

list:
  -JobA
  -JobB

so that I can use JobsList in my multijob definition.这样我就可以在我的多作业定义中使用 JobsList。 Something like this:是这样的:

job:
  name: test_job
  project-type: multijob
  builders:
    - multijob:
        name: PhaseOne
        condition: SUCCESSFUL
        projects: JobsList

and it expands into它扩展为

  job:
  name: test_job
  project-type: multijob
  builders:
    - multijob:
        name: PhaseOne
        condition: SUCCESSFUL
        projects:
          - name: JobA
            current-parameters: true
          - name: JobB
            current-parameters: true

Any suggestion, how to do this?任何建议,如何做到这一点?

-Archna -Archna

I am almost sure you cannot do that.我几乎可以肯定你不能那样做。 I am pretty noob to above too, but I only saw so far your extended version.我对上面的内容也很陌生,但到目前为止我只看到了你的扩展版本。

My advice is that if you would be able to implement a what you want, using variables, it would be too confusing and hard to follow.我的建议是,如果你能够使用变量实现你想要的东西,那将太混乱并且难以理解。 Just keep it basic and have a normal list:保持基本并有一个正常的列表:

projects:
  - name: JobA
    current-parameters: true
  - name: JobB
    current-parameters: true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM