-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
69 lines (63 loc) · 1.84 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
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env groovy
/*
* Jenkinsfile
* ldgmini/bundler
*
* Ensures Bundler is installed and working correctly.
*/
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')),
])
try {
timeout(time: 1, unit: 'HOURS') {
withEnv(['LANG=en_US.UTF-8']) {
node {
stage("🛒 Checkout") {
checkout scm
}
stage("📦 Bundler") {
// https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#sh-shell-script
sh(
script: "gem list bundler",
label: "💎 List gems"
)
sh(
script: "which bundle",
label: "❓ Which"
)
sh(
script: "bundle --version",
label: "🏃🏻♂️ Run bundler"
)
}
}
}
}
}
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.message}
|
|${env.BUILD_URL}/console
|""".stripMargin()
mail to: MAIL_TO,
subject: subject,
body: body
throw ex
}