-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
57 lines (50 loc) · 1.42 KB
/
Jenkinsfile
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
52
53
54
55
56
57
#!/usr/bin/env groovy
/**
* Sample Jenkinsfile for Jenkins2 Pipeline
* from https://github.com/hotwilson/jenkins2/edit/master/Jenkinsfile
* by wilsonmar@gmail.com
*/
import hudson.model.*
import hudson.EnvVars
import groovy.json.JsonSlurperClassic
import groovy.json.JsonBuilder
import groovy.json.JsonOutput
import java.net.URL
try {
node {
stage '\u2776 Stage 1'
echo "\u2600 BUILD_URL=${env.BUILD_URL}"
sh('git describe')
sh('git describe > GIT_COMMIT')
git_commit=readFile('GIT_COMMIT')
echo "\u2600 ${git_commit}"
def workspace = pwd()
echo "\u2600 workspace=${workspace}"
stage '\u2777 Stage 2'
} // node
} // try end
catch (exc) {
/*
err = caughtError
currentBuild.result = "FAILURE"
String recipient = 'infra@lists.jenkins-ci.org'
mail subject: "${env.JOB_NAME} (${env.BUILD_NUMBER}) failed",
body: "It appears that ${env.BUILD_URL} is failing, somebody should do something about that",
to: recipient,
replyTo: recipient,
from: 'noreply@ci.jenkins.io'
*/
} finally {
(currentBuild.result != "ABORTED") && node("master") {
// Send e-mail notifications for failed or unstable builds.
// currentBuild.result must be non-null for this step to work.
step([$class: 'Mailer',
notifyEveryUnstableBuild: true,
recipients: "${email_to}",
sendToIndividuals: true])
}
// Must re-throw exception to propagate error:
if (err) {
throw err
}
}