-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
59 lines (52 loc) · 1.49 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
58
59
#!/usr/bin/env groovy
/*
* Jenkinsfile
* JenkinOSVersion
*/
import jenkins.model.*
def MAIL_TO = JenkinsLocationConfiguration.get().getAdminAddress()
echo "MAIL_TO: $MAIL_TO"
properties([
// Don't trigger this job when changes are found from branch indexing.
//overrideIndexTriggers(false),
disableConcurrentBuilds(),
pipelineTriggers([
cron('H 1 * * *')
]),
buildDiscarder(logRotator(numToKeepStr: '100')),
])
// Global variables
String output
try {
timeout(time: 1, unit: 'HOURS') {
withEnv(['LANG=en_US.UTF-8']) {
node {
stage("🖥️ macOS Version") {
// https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#sh-shell-script
sh(
script: "sw_vers -productVersion; system_profiler SPSoftwareDataType; uname -a",
label: "🖥️ macOS Version"
)
}
}
}
}
}
catch (Exception ex) {
String jobName = env.JOB_NAME
String buildNumber = env.BUILD_NUMBER
String subject = "👷🏻♂️ [FAILURE] $jobName - Build #$buildNumber"
String body = """$jobName
|Build #${buildNumber} - FAILURE
|
|${env.BUILD_URL}
|
|${ex}
|
|${env.BUILD_URL}console
|""".stripMargin()
mail to: MAIL_TO,
subject: subject,
body: body
throw ex
}