Skip to content

Instantly share code, notes, and snippets.

@michaelneale
Created September 17, 2015 07:06
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save michaelneale/99505759ef90b858b7a3 to your computer and use it in GitHub Desktop.
Save michaelneale/99505759ef90b858b7a3 to your computer and use it in GitHub Desktop.
stage "preparation"
node {
parallel (
phase1: { sh "echo p1; echo phase1" },
phase2: { sh "echo p2; echo phase2" }
)
sh "echo 42 > data"
stash includes: '*', name: 'binary'
}
stage "do the build"
parallel (
"stream 1": {
node {
unstash "binary"
sh "sleep 20s"
sh "echo hstream1"
}
},
stream2: {
node {
unstash "binary"
sh "echo hello2"
}
}
)
@jglick
Copy link

jglick commented Sep 18, 2015

includes: '*' is the default (actually ** in case there are subdirectories), so you can simply write

stash 'binary'

if you like.

Tip: start your script with

#!groovy

to enable Groovy coloration.

@alexMarcon
Copy link

alexMarcon commented Jul 28, 2017

Hello, I know this is kinda old ... and I'm relatively new with this, so my question is, based on the example above, is it possible to trigger another set of parallel phases within phase1? I mean, when an specific build finishes on phase1, I'd like to start another set of builds (parallel) dependent on the output of phase1. Of course, phase 2, 3, N...would be doing the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment