Hubert Bratek
Hubert Bratek

Reputation: 1104

Jenkins Trigger with choice param

I am trying to create a trigger which would poll my scm and run a job with a specified parameter.

I have a choiceParam.

        parameters {
            choiceParam('MY_PARAM', ['param1', 'param2', 'param3'], 'My param')
        }

And I would like to the job to be triggered automatically always with the same choiceParam(for instance with param1)

Is it possible? If so how?

        triggers {
            scm "*/10 * * * *"
            parameters {
                What should be here????
            }
        }

Upvotes: 1

Views: 485

Answers (2)

Hubert Bratek
Hubert Bratek

Reputation: 1104

As I have checked, choice params list default value is the first one. So in my scenario it would be param1.

    triggers {
        scm "*/10 * * * *"
    }

So that situation would automatically run with param1

Upvotes: 1

smelm
smelm

Reputation: 1334

Choice parameters are nothing but string parameters under the hood. So you would call it like this:

parameters {
    string(name: "MY_PARAM", value: "param1")
}

Upvotes: 0

Related Questions