I have a Jenkins pipeline that runs several stages in parallel. Some of those stages produce intermediate build files that I'd like to reuse in a later step:
pipeline {
stages {
stage("Parallel build") {
parallel {
stage("A") { /* produces file A */ }
stage("B") { /* produces file B */ }
stage("C") { /* produces nothing relevant */ }
}
}
stage("Combine") {
/* runs a task that needs files A and B */
}
}
}
As far as I've been able to tell, Jenkins will randomly give me the workspace from one of the parallel stages. So my Combine step will have file A, B or neither, but not both.
How do I resolve this issue?