patternMinor
Using Jenkins declarative when conditions in scripted pipelines
Viewed 0 times
declarativepipelinesjenkinsusingconditionswhenscripted
Problem
Jenkins declarative pipelines offer very convenient when directive with conditions like changeset.
Is is possible the this changeset and other when conditions in a scripted pipeline?
Is is possible the this changeset and other when conditions in a scripted pipeline?
Solution
It would seem not - in the scripted pipeline, groovy needs to be used - see the docs
(taken straight from the docs)
This would be the same as
node {
stage('Example') {
if (env.BRANCH_NAME == 'master') {
echo 'I only execute on the master branch'
} else {
echo 'I execute elsewhere'
}
}
}
(taken straight from the docs)
This would be the same as
when { branch 'master' }Context
StackExchange DevOps Q#11200, answer score: 1
Revisions (0)
No revisions yet.