-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Critical
-
Environment:Jenkins version 2.46.2
Pipeline: Multibranch version 2.14
I would like to execute 2 stages on 2 different nodes. First stage should be executed always, and the second under a certain condition.
Everything works, except that when the second stage is not executed (the 'when' expression is not satisfied),Ā a checkout of the repository is still done.Ā
This is the Jenkinsfile:
pipeline {
agent { label 'node_1' }
stages {
stage("Stage 1") {
steps {
script {
echo "Stage 1"
}
}
}
stage ('Stage 2') {
when {
expression { env.BRANCH_NAME == "master" }
}
agent { label 'node_2' }
steps {
script {
echo "Stage 2"
}
}
}
}
}
The big problem with this is that inĀ case the 'node_2' is executing other jobs, the current job cannot continue untilĀ this node has a free executor.Ā
Ā