-
Type:
Bug
-
Resolution: Not A Defect
-
Priority:
Minor
-
Component/s: pipeline-model-definition-plugin
-
Environment:Jenkins 2.112
Pipeline: API 2.26
Pipeline: Model API 1.2.7
The when branch conditional seems to still be broken. Similar to . In this case we are using GitHub with webhooks to trigger a build. Following the good test code in 41012 I tested with the following. JENKINS-41012
Results - I get echo expression and echo env, but branch is always skipped.Â
Test pipeline code stage is:
stages {
stage('test condition: expression') {
when {
expression {
return env.GIT_BRANCH == "origin/master"
}
}
steps {
sh 'echo "expression"'
}
}
stage('test when: env') {
when {
environment name: "GIT_BRANCH", value: "origin/master"
}
steps {
sh 'echo "env"'
}
}
stage('test when: branch') {
when {
branch "origin/master"
}
steps {
sh 'echo "branch"'
}
}
}