Reputation: 73195
I am writing a pipeline for a cross-platform application. The goal is to have a single stage for checking out the source code from SCM and then having a number of slaves build the application for each platform from that checkout.
Here is a rough overview of what I have:
pipeline {
agent none
stages {
stage('Checkout') {
agent any
steps {
checkout([extensions: [[$class: 'CleanBeforeCheckout']], ...]]])
}
}
stage('Build') {
parallel {
stage('win') {
agent { label 'win' }
steps { ... }
}
stage('mac') {
agent { label 'mac' }
steps { ... }
}
}
}
}
}
The problem is that the parallel stages are not using the clean checkout from the first stage. They are simply reusing the workspace from the previous build.
How would I go about fixing this?
Upvotes: 2
Views: 1535
Reputation: 2882
Stash the workspace in the checkout stage and then unstash in each subsequent stage.
Upvotes: 1