Skip to content
Permalink
Browse files

[JENKINS-41334] Add parallel stages documentation

  • Loading branch information...
abayer committed Jul 28, 2017
1 parent 779ccff commit 35bd40690e95e96239bd9e07922d3f47a0ab407e
Showing with 54 additions and 0 deletions.
  1. +54 −0 content/doc/book/pipeline/syntax.adoc
@@ -889,6 +889,60 @@ pipeline {
// Script //
----

=== Parallel

Stages in Declarative Pipeline may declare a number of nested stages within
them, which will be executed in parallel. Note that a stage must have one and
only one of either `steps` or `parallel`. The nested stages may use all other
configuration available for stages in Declarative Pipeline, including `when`,
`environment`, `agent`, `post`, and `tools`, but are required to have `steps`
and cannot contain further `parallel` stages themselves. Any stage containing
`parallel` cannot contain `agent` or `tools`, since those are not relevant
without `steps`.

[[parallel-stages-example]]
===== Example

[pipeline]
----
// Declarative //
pipeline {
agent any
stages {
stage('Non-Parallel Stage') {
steps {
echo 'This stage will be executed first.'
}
}
stage('Parallel Stage') {
when {
branch 'master'
}
parallel {
stage('Branch A') {
agent {
label "for-branch-a"
}
steps {
echo "On Branch A"
}
}
stage('Branch B') {
agent {
label "for-branch-b"
}
steps {
echo "On Branch B"
}
}
}
}
}
}
// Script //
----

[[declarative-steps]]
=== Steps

1 comment on commit 35bd406

@Bertg

This comment has been minimized.

Copy link

commented on 35bd406 Oct 3, 2017

Nice!

Please sign in to comment.
You can’t perform that action at this time.