-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
172 lines (170 loc) · 6.71 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
def BuildBadge = addEmbeddableBadgeConfiguration(id: "build", subject: "Build")
def TestBadge = addEmbeddableBadgeConfiguration(id: "test", subject: "Test")
pipeline {
options {
// the variable $WORKSPACE is assigned dynamically at the beginning of every stage
// and might change depending on the number of concurrent builds active.
// We can only allow 1 concurrent build to have a consistent access to $WORKSPACE
// Otherwise we should use stash/unstash for the miniconda installation
disableConcurrentBuilds()
}
environment {
EMAIL_TO_1 = '[email protected]'
EMAIL_TO_2 = '[email protected]'
CONDA_ENV_NAME = 'iconarray'
}
agent none
stages {
stage('Setup') {
parallel {
stage('setup miniconda on daint') {
agent { label 'daint' }
environment {
PATH = "$WORKSPACE/miniconda_$NODE_NAME/bin:$PATH"
}
steps {
script {
BuildBadge.setStatus('running')
}
sh './setup.sh'
}
post {
failure {
echo 'Cleaning up workspace'
deleteDir()
}
}
}
stage('setup miniconda on tsa') {
agent { label 'tsa' }
environment {
PATH = "$WORKSPACE/miniconda_$NODE_NAME/bin:$PATH"
}
steps {
script {
BuildBadge.setStatus('running')
}
sh './setup.sh'
}
post {
failure {
echo 'Cleaning up workspace'
deleteDir()
}
}
}
}
post {
failure {
node('tsa') {
script {
BuildBadge.setStatus('failing')
}
}
}
success {
node('tsa') {
script {
BuildBadge.setStatus('passing')
}
}
}
}
}
stage('Test') {
parallel {
stage('test on daint') {
agent { label 'daint' }
environment {
PATH = "$WORKSPACE/miniconda_${NODE_NAME}/bin:$PATH"
}
steps {
script {
TestBadge.setStatus('running')
}
sh './test.sh'
}
post {
success {
mail bcc: '',
body: "<b>Jenkins Success</b><br>Project: ${env.JOB_NAME}<br>Build Number: ${env.BUILD_NUMBER}<br>Build URL: ${env.BUILD_URL}" ,
cc: "${EMAIL_TO_2}", charset: 'UTF-8', from: '', mimeType: 'text/html',
replyTo: '', subject: "Jenkins Job Success ${NODE_NAME} ->${env.JOB_NAME}",
to: "${EMAIL_TO_1}";
}
failure {
script {
mail bcc: '',
body: "<b>Jenkins Failure</b><br>Project: ${env.JOB_NAME}<br>Build Number: ${env.BUILD_NUMBER}<br>Build URL: ${env.BUILD_URL}" ,
cc: "${EMAIL_TO_2}", charset: 'UTF-8', from: '', mimeType: 'text/html',
replyTo: '', subject: "Jenkins Job Failure ${NODE_NAME} -> ${env.JOB_NAME}",
to: "${EMAIL_TO_1}";
}
}
always {
archiveArtifacts artifacts: '*.log', allowEmptyArchive: true
echo 'Cleaning up workspace'
deleteDir()
}
}
}
stage('test on tsa') {
agent { label 'tsa' }
environment {
PATH = "$WORKSPACE/miniconda_${NODE_NAME}/bin:$PATH"
}
steps {
script {
TestBadge.setStatus('running')
}
sh './test.sh'
}
post {
success {
mail bcc: '',
body: "<b>Jenkins Success</b><br>Project: ${env.JOB_NAME}<br>Build Number: ${env.BUILD_NUMBER}<br>Build URL: ${env.BUILD_URL}" ,
cc: "${EMAIL_TO_2}", charset: 'UTF-8', from: '', mimeType: 'text/html',
replyTo: '', subject: "Jenkins Job Success ${NODE_NAME} ->${env.JOB_NAME}",
to: "${EMAIL_TO_1}";
}
failure {
mail bcc: '',
body: "<b>Jenkins Failure</b><br>Project: ${env.JOB_NAME}<br>Build Number: ${env.BUILD_NUMBER}<br>Build URL: ${env.BUILD_URL}" ,
cc: "${EMAIL_TO_2}", charset: 'UTF-8', from: '', mimeType: 'text/html',
replyTo: '', subject: "Jenkins Job Failure ${NODE_NAME} -> ${env.JOB_NAME}",
to: "${EMAIL_TO_1}";
}
always {
archiveArtifacts artifacts: '*.log', allowEmptyArchive: true
echo 'Cleaning up workspace'
deleteDir()
}
}
}
}
post {
failure {
node('tsa') {
script {
TestBadge.setStatus('failing')
}
}
}
success {
node('tsa') {
script {
TestBadge.setStatus('passing')
}
}
}
}
}
}
post {
always {
node('tsa') {
deleteDir()
}
}
}
}