Skip to content

Commit 0d8a8e1

Browse files
Update Jenkinsfile
1 parent 679a3cb commit 0d8a8e1

File tree

1 file changed

+11
-46
lines changed

1 file changed

+11
-46
lines changed

Jenkinsfile

Lines changed: 11 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,13 @@
1-
#!groovy
2-
1+
stage 'Init'
32
node {
4-
5-
6-
currentBuild.result = "SUCCESS"
7-
8-
try {
9-
10-
stage('Checkout'){
11-
12-
checkout scm
13-
}
14-
15-
stage('Sonar') {
16-
//add stage sonar
17-
sh 'mvn sonar:sonar'
18-
}
19-
20-
21-
stage('mail'){
22-
23-
24-
mail body: 'project build successful',
25-
26-
replyTo: '[email protected]',
27-
subject: 'project build successful',
28-
29-
}
30-
31-
32-
33-
}
34-
catch (err) {
35-
36-
currentBuild.result = "FAILURE"
37-
38-
mail body: "project build error is here: ${env.BUILD_URL}" ,
39-
40-
replyTo: '[email protected]',
41-
subject: 'project build failed',
42-
43-
44-
throw err
45-
}
46-
}
47-
3+
checkout scm
4+
sh 'echo $BRANCH_NAME'
5+
}
6+
if (env.BRANCH_NAME == 'master') {
7+
stage 'Only on master'
8+
println 'This happens only on master'
9+
} else {
10+
stage 'Other branches'
11+
println "Current branch ${env.BRANCH_NAME}"
12+
}
4813

0 commit comments

Comments
 (0)