-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmulti-pipeline.groovy
51 lines (40 loc) · 1.04 KB
/
multi-pipeline.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* Example of running 2 pipeline declarations in the same Job
*
* Why? You might want an approval section that does not tie up a node or some script that runs outside any
* pipeline declaration without using an executor.
*
* It does seem to be a loophole to allow multiple pipelines in a single job
*
*/
// First pipeline declaration
pipeline {
// Run on any node
agent any
stages {
stage('Section 1') {
steps {
echo "Section 1 pipeline"
// This will tie up a node. Look at executors while waiting.
input message: 'Wait for process', ok: 'Done waiting'
}
}
}
}
// This does not tie up a nodeLook at executors while waiting.
stage('Approval') {
echo "Approval stage"
input message: 'Approve next section', ok: 'Approve'
}
// Second pipelne declaration
pipeline {
// Run on any node
agent any
stages {
stage('Section 2') {
steps {
echo "Pipeline section 2"
}
}
}
}