Goal
Run multiple stages of a declarative Jenkins pipeline on the same node.
Setup
This is just a minimal example to show the p
I have found that this works as you would expect
#!groovy
windowsNode = 'windows'
pipeline {
agent none
stages {
stage('Stage 1') {
steps {
node(windowsNode) {
script {
// all subsequent steps should be run on the same windows node
windowsNode = NODE_NAME
}
echo "windowsNode: $windowsNode, NODE_NAME: $NODE_NAME"
}
}
}
stage('Stage 2') {
steps {
node(windowsNode) {
echo "windowsNode: $windowsNode, NODE_NAME: $NODE_NAME"
}
}
}
}
}