rjsha
rjsha

Reputation: 1

Jenkins run job with different parameter one by one

I have a job with multiple parameters, but one is a choice parameter and it contains 10 choices, i need to build this job with all these choices one by one.

is that possible?

Upvotes: 0

Views: 1142

Answers (1)

Povilas Dauksas
Povilas Dauksas

Reputation: 11

You can achieve this by using Jenkins Declarative Pipelines.

Here is an example pipeline which iterates through selected multi-choice parameter:

pipeline {
  agent any
  parameters {
    choice(name: 'CHOICE', choices: ['One', 'Two', 'Three'], description: 'Please select one/multiple options.')
  }
  stages {
    stage('Build') {
        steps {
          script {
             for (String selectedChoice : params.CHOICE) {
              // do something
             }
          }
       }
    }
  }
}

Upvotes: 1

Related Questions