使用选择和布尔参数在 Jenkins 管道中触发作业?
Triggering job in Jenkins pipeline with choice and boolean parameters?
我想让我的 Job1 管道触发 Job2,其中 Job2 需要“字符串”、“选择”和“布尔”参数。所以在 Job1 上,我有
build job: "Job2",
parameters[
string(name: "STRING_PARAM", value: "someStrig"),
choice(name: "CHOICE_PARAM", value: "someChoice"),
booleanParam(name: "BOOL_PARAM", value: true)
],
wait: false
然而,它不喜欢choice
。我试过 choiceParam
但它也不喜欢那样。正确的语法是什么?谢谢
您可以使用 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
我想让我的 Job1 管道触发 Job2,其中 Job2 需要“字符串”、“选择”和“布尔”参数。所以在 Job1 上,我有
build job: "Job2",
parameters[
string(name: "STRING_PARAM", value: "someStrig"),
choice(name: "CHOICE_PARAM", value: "someChoice"),
booleanParam(name: "BOOL_PARAM", value: true)
],
wait: false
然而,它不喜欢choice
。我试过 choiceParam
但它也不喜欢那样。正确的语法是什么?谢谢
您可以使用 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