0

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. 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

          - 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. 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

1 Answers1

0

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
pustiul500
  • 55
  • 11