-
Notifications
You must be signed in to change notification settings - Fork 0
/
JenkinsfilePost
41 lines (36 loc) · 1.04 KB
/
JenkinsfilePost
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
pipeline {
environment {
//This variable need be tested as string
doError = '1'
}
agent {
label 'slave1'
}
stages {
stage('Error') {
when {
expression { doError == '1' }
}
steps {
echo "Failure"
error "failure test. It's work"
}
}
stage('Success') {
when {
expression { doError == '0' }
}
steps {
echo "ok"
}
}
}
post {
always {
echo 'I will always say Hello again!'
emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}"
}
}
}