Issue
I am trying to implement parallelization in my Jenkins pipeline code where I can run two stages in parallel. I know this is possible in declarative pipeline, but I am using scripted pipeline.
I've attempted to implement this by doing something like this:
parallel(
stage('StageA') {
echo "This is branch a"
},
stage('StageB') {
echo "This is branch b"
}
)
When I run this and look at this in Blue ocean, the stages do not run in parallel, but instead, StageB is executed after StageA. Is it possible to have parallel stages in scripted jenkins pipeline? If so, how?
Solution
Try this syntax for scripted pipeline:
parallel(
"StageA": {
echo "This is branch a"
},
"StageB": {
echo "This is branch b"
}
)
It should look like this in Blue Ocean, this is what you expect right?
If you want to see the stages (and console output) in the classic view, you can use stage like this:
parallel(
"StageA": {
stage("stage A") {
echo "This is branch a"
}
},
"StageB": {
stage("stage B") {
echo "This is branch b"
}
}
)
Answered By - Unforgettable631 Answer Checked By - Willingham (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.