Skip to content

Commit 6bf6031

Browse files
authored
Create StageFailure
1 parent d9503a0 commit 6bf6031

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

JENKINS/StageFailure

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Running pipeline stages in parallel:
2+
**********************************************
3+
4+
pipeline {
5+
agent any
6+
stages {
7+
stage('Parallel Stage') {
8+
when {
9+
branch 'master'
10+
}
11+
failFast false
12+
parallel {
13+
stage('Branch A') {
14+
agent {
15+
label "for-branch-a"
16+
}
17+
steps {
18+
echo "On Branch A"
19+
}
20+
}
21+
stage('Branch B') {
22+
agent {
23+
label "for-branch-b"
24+
}
25+
steps {
26+
echo "On Branch B"
27+
}
28+
}
29+
}
30+
}
31+
}
32+
}
33+
34+
**************************************
35+
36+
pipeline {
37+
agent any
38+
stages {
39+
stage('1') {
40+
steps {
41+
sh 'exit 0'
42+
}
43+
}
44+
stage('2') {
45+
steps {
46+
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
47+
sh "exit 1"
48+
}
49+
}
50+
}
51+
stage('3') {
52+
steps {
53+
sh 'exit 0'
54+
}
55+
}
56+
}
57+
}
58+
In the example above, all stages will execute, the pipeline will be successful, but stage 2 will show as failed:
59+

0 commit comments

Comments
 (0)