我有詹金斯Groovy腳本是這樣的:booleanParam在詹金斯DSL
freeStyleJob(「test」) {
properties { githubProjectUrl(‘…’) }
description(‘’’job description’’’.stripMargin('|'))
logRotator{ numToKeep(100) }
parameters {
stringParam(’STRINGP1’, "", 「STRINGP1 description」)
stringParam('STRINGP2’, "", 「StringP2 description」)
booleanParam(‘b1’, false)
booleanParam(‘b2’, false)
booleanParam(‘b3’, false)
stringParam("EMAIL_LIST", "", "Emails")
}
scm {
github(‘repo’, '${STRINGP1}', 'git', ‘giturl’)
}
steps {
shell '''|#!/bin/bash
|ARGS=""
|fi
|if [[ ‘${b1}’ ]]; then
| ARGS=$ARGS" —-p b1」
|fi
|if [[ ‘${b2}’ ]]; then
| OS_ARGS=$ARGS" —-p b2」
|fi
|if [[ ‘${b3}’ ]]; then
| ARGS=$ARGS" —-p b3」
|fi
|echo ${ARGS}'''.stripMargin('|')
}
publishers {
archiveArtifacts {
pattern(‘pattern’)
}
extendedEmail {
....
}
}
}
....
}
的創造就業機會的不管用戶選中或取消選中UI中的布爾參數之後,ARGS值將始終「 - p b1 --- p b2 - p b3「。這意味着如果存在於shell腳本中的三個值總是被評估爲true。爲什麼會發生?