-
Bug
-
Resolution: Unresolved
-
Major
-
None
When using 'when' expression, multibranch pipeline does not skip the condition but executes the stage.
I've 3 stages, Build, Deploy to QA and Prod (which is not show in the snippet. Build has nested stages with when condition. I want to build from any branch or tag starts with release/*. hence I have a when condition in Build Stage (nested).
Then when it come to deployment, I want Deploy to QA to be executed when 'when' expression matched to the release.* "REGEX". But instead of skipping on any branch, it executes the stage.
Pipeline:
pipeline { agent none stages { stage('Build') { agent { node ('master') } stages { stage ('Setup') { agent { node { label '' } } when { branch '**' tag pattern: "release.*", comparator: "REGEXP" } steps { //some stuff here } } } } } } stage('Deploy to QA') { agent { node { label '' } } when { tag pattern: 'release.*', comparator: "REGEXP" } steps { //some stuff here } } } } } }