5

I'm sure there's an easy answer for this but I was unable to find it elsewhere.

I have a Jenkins workflow job with parameters. What I want is to skip a build job depending on the value of a parameter. Something like:

if(param["MYPARAM"]){
    build("jorb1")
}
build("jorb2")

Does anyone know how I'd accomplish this?

4

1 回答 1

8

原来答案真的很简单。希望这会对其他人有所帮助。If 语句在 DSL 配置中确实有效。我猜它是基于 groovy 的(我对此的经验为零)。无论如何,除了错误地指定参数之外,我的猜测几乎是正确的。以下是检查字符串参数的示例:

if(params["MYPARAM"]=="some_value"){
    build("jorb1")
}
build("jorb2")
于 2013-11-07T18:59:32.967 回答