Can Steps in a Stage of a Pipeline Be Dependent? For example, there are step A, step B, step C, and step D in a stage. B and C depend on A. That is, B and C can be run only after A is run. B and C run at the same time, and D can only be run after C is finished. Is there any way to do that?
by default steps in a stage of a pipeline are executed sequentially
you need to use the parallel step if you want to run something in parallel.
See this simple pipeline
node() {
sh 'echo step A'
parallel stepB: {
sh '''
echo stepB
sleep 2
echo stepB
sleep 2
echo stepB
'''
},
stepC: {
sh '''
echo stepC
sleep 1
echo stepC
sleep 1
echo stepC
'''
}
sh 'echo stepD'
}
1 Like
What if the dependencies between steps are complex?