-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Jenkins 2.387.2
I have a working multibranch pipeline and am trying to add a conditional stage that only runs when the branch is main and the build is triggered by code being pushed/merged or a release tag is added. My stage looks like this:
stage ('Sync') {
when {
branch 'main'
anyOf
}
steps {
build job: "wkt-sync"
}
}
In the Jenkins job triggered by the GitLab Branch Source Plugin, I see:
Push event to branch main
Started by GitLab push by Robert Patrick
Querying the current revision of branch main...
Current revision of branch main is 38d353c06e85d83af79a6e599c098a9d0203727d
Obtained Jenkinsfile from 38d353c06e85d83af79a6e599c098a9d0203727d
But when the job runs, I see:
{{}}
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Sync)
Stage "Sync" skipped due to when conditional
[Pipeline] }
What am I doing wrong?