Home > database >  Triggering job in Jenkins pipeline with choice and boolean parameters?
Triggering job in Jenkins pipeline with choice and boolean parameters?

Time:12-17

I want to my Job1 pipeline to tigger Job2, where Job2 expects "string", "choice" and "boolean" parameters. So on Job1, I have

build job: "Job2",
      parameters[
        string(name: "STRING_PARAM", value: "someStrig"),
        choice(name: "CHOICE_PARAM", value: "someChoice"),
        booleanParam(name: "BOOL_PARAM", value: true)
      ],
      wait: false

However, it doesn't like choice. I tried choiceParam and it didn't like that either. What's the correct syntax? Thanks.

CodePudding user response:

You can use StringParameterValue:

  build job: "Job2",
      parameters: [
          [$class: 'StringParameterValue', name: "STRING_PARAM", value: "someStrig"],
          [$class: 'StringParameterValue', name: "CHOICE_PARAM", value: "someChoice"],
          [$class: 'StringParameterValue', name: "BOOL_PARAM", value: true],
        ],
      wait: false
  • Related