@@ -29,9 +29,6 @@ pipeline {
29
29
}
30
30
31
31
environment {
32
- SOURCEDIR = ' src'
33
- // will also need to change notification section below
34
- PATCHDIR = ' out'
35
32
YETUS = ' yetus'
36
33
// Branch or tag name. Yetus release tags are 'rel/X.Y.Z'
37
34
YETUS_VERSION = ' f9ba0170a5787a5f4662d3769804fef0226a182f'
@@ -56,13 +53,44 @@ pipeline {
56
53
}
57
54
}
58
55
56
+ // Setup codebase so that each platform's build happens in its own exclusive copy of the
57
+ // codebase.
58
+ // Primarily because YETUS messes up the git branch information and affects the subsequent
59
+ // optional stages after the first one.
60
+ stage (' setup sources' ) {
61
+ steps {
62
+ dir(" ${ WORKSPACE} /centos-8" ) {
63
+ sh ''' #!/usr/bin/env bash
64
+
65
+ cp -Rp ${WORKSPACE}/src ${WORKSPACE}/centos-8
66
+ '''
67
+ }
68
+
69
+ dir(" ${ WORKSPACE} /debian-10" ) {
70
+ sh ''' #!/usr/bin/env bash
71
+
72
+ cp -Rp ${WORKSPACE}/src ${WORKSPACE}/debian-10
73
+ '''
74
+ }
75
+
76
+ dir(" ${ WORKSPACE} /ubuntu-focal" ) {
77
+ sh ''' #!/usr/bin/env bash
78
+
79
+ cp -Rp ${WORKSPACE}/src ${WORKSPACE}/ubuntu-focal
80
+ '''
81
+ }
82
+ }
83
+ }
84
+
59
85
// This is an optional stage which runs only when there's a change in
60
86
// C++/C++ build/platform.
61
87
// This stage serves as a means of cross platform validation, which is
62
88
// really needed to ensure that any C++ related/platform change doesn't
63
89
// break the Hadoop build on Centos 8.
64
90
stage (' precommit-run Centos 8' ) {
65
91
environment {
92
+ SOURCEDIR = " ${ WORKSPACE} /centos-8/src"
93
+ PATCHDIR = " ${ WORKSPACE} /centos-8/out"
66
94
DOCKERFILE = " ${ SOURCEDIR} /dev-support/docker/Dockerfile_centos_8"
67
95
IS_OPTIONAL = 1
68
96
}
@@ -78,10 +106,32 @@ pipeline {
78
106
sh ''' #!/usr/bin/env bash
79
107
80
108
chmod u+x "${SOURCEDIR}/dev-support/jenkins.sh"
81
- "${SOURCEDIR}/dev-support/jenkins.sh"
109
+ "${SOURCEDIR}/dev-support/jenkins.sh" run_ci
82
110
'''
83
111
}
84
112
}
113
+
114
+ post {
115
+ // Since this is an optional platform, we want to copy the artifacts
116
+ // and archive it only if the build fails, to help with debugging.
117
+ failure {
118
+ sh ''' #!/usr/bin/env bash
119
+
120
+ cp -Rp "${WORKSPACE}/centos-8/out" "${WORKSPACE}"
121
+ '''
122
+ archiveArtifacts " out/**"
123
+ }
124
+
125
+ cleanup() {
126
+ script {
127
+ sh ''' #!/usr/bin/env bash
128
+
129
+ chmod u+x "${SOURCEDIR}/dev-support/jenkins.sh"
130
+ "${SOURCEDIR}/dev-support/jenkins.sh" cleanup_ci_proc
131
+ '''
132
+ }
133
+ }
134
+ }
85
135
}
86
136
87
137
// This is an optional stage which runs only when there's a change in
@@ -91,6 +141,8 @@ pipeline {
91
141
// break the Hadoop build on Debian 10.
92
142
stage (' precommit-run Debian 10' ) {
93
143
environment {
144
+ SOURCEDIR = " ${ WORKSPACE} /debian-10/src"
145
+ PATCHDIR = " ${ WORKSPACE} /debian-10/out"
94
146
DOCKERFILE = " ${ SOURCEDIR} /dev-support/docker/Dockerfile_debian_10"
95
147
IS_OPTIONAL = 1
96
148
}
@@ -106,16 +158,40 @@ pipeline {
106
158
sh ''' #!/usr/bin/env bash
107
159
108
160
chmod u+x "${SOURCEDIR}/dev-support/jenkins.sh"
109
- "${SOURCEDIR}/dev-support/jenkins.sh"
161
+ "${SOURCEDIR}/dev-support/jenkins.sh" run_ci
110
162
'''
111
163
}
112
164
}
165
+
166
+ post {
167
+ // Since this is an optional platform, we want to copy the artifacts
168
+ // and archive it only if the build fails, to help with debugging.
169
+ failure {
170
+ sh ''' #!/usr/bin/env bash
171
+
172
+ cp -Rp "${WORKSPACE}/debian-10/out" "${WORKSPACE}"
173
+ '''
174
+ archiveArtifacts " out/**"
175
+ }
176
+
177
+ cleanup() {
178
+ script {
179
+ sh ''' #!/usr/bin/env bash
180
+
181
+ chmod u+x "${SOURCEDIR}/dev-support/jenkins.sh"
182
+ "${SOURCEDIR}/dev-support/jenkins.sh" cleanup_ci_proc
183
+ '''
184
+ }
185
+ }
186
+ }
113
187
}
114
188
115
189
// We want to use Ubuntu Focal as our main CI and thus, this stage
116
190
// isn't optional (runs for all the PRs).
117
191
stage (' precommit-run Ubuntu focal' ) {
118
192
environment {
193
+ SOURCEDIR = " ${ WORKSPACE} /ubuntu-focal/src"
194
+ PATCHDIR = " ${ WORKSPACE} /ubuntu-focal/out"
119
195
DOCKERFILE = " ${ SOURCEDIR} /dev-support/docker/Dockerfile"
120
196
IS_OPTIONAL = 0
121
197
}
@@ -131,69 +207,76 @@ pipeline {
131
207
sh ''' #!/usr/bin/env bash
132
208
133
209
chmod u+x "${SOURCEDIR}/dev-support/jenkins.sh"
134
- "${SOURCEDIR}/dev-support/jenkins.sh"
210
+ "${SOURCEDIR}/dev-support/jenkins.sh" run_ci
135
211
'''
136
212
}
137
213
}
138
- }
139
214
140
- }
215
+ post {
216
+ always {
217
+ script {
218
+ // Publish status if it was missed (YETUS-1059)
219
+ withCredentials(
220
+ [usernamePassword(credentialsId : ' 683f5dcf-5552-4b28-9fb1-6a6b77cf53dd' ,
221
+ passwordVariable : ' GITHUB_TOKEN' ,
222
+ usernameVariable : ' GITHUB_USER' )]) {
223
+ sh ''' #!/usr/bin/env bash
141
224
142
- post {
143
- always {
144
- script {
145
- // Publish status if it was missed (YETUS-1059)
146
- withCredentials(
147
- [usernamePassword(credentialsId : ' 683f5dcf-5552-4b28-9fb1-6a6b77cf53dd' ,
148
- passwordVariable : ' GITHUB_TOKEN' ,
149
- usernameVariable : ' GITHUB_USER' )]) {
150
- sh ''' #!/usr/bin/env bash
151
- YETUS_ARGS+=("--github-token=${GITHUB_TOKEN}")
152
- YETUS_ARGS+=("--patch-dir=${WORKSPACE}/${PATCHDIR}")
153
- TESTPATCHBIN="${WORKSPACE}/${YETUS}/precommit/src/main/shell/github-status-recovery.sh"
154
- /usr/bin/env bash "${TESTPATCHBIN}" "${YETUS_ARGS[@]}" ${EXTRA_ARGS} || true
155
- '''
156
- }
225
+ # Copy the artifacts of Ubuntu focal build to workspace
226
+ cp -Rp "${WORKSPACE}/ubuntu-focal/out" "${WORKSPACE}"
227
+
228
+ # Send Github status
229
+ chmod u+x "${SOURCEDIR}/dev-support/jenkins.sh"
230
+ "${SOURCEDIR}/dev-support/jenkins.sh" github_status_recovery
231
+ '''
232
+ }
157
233
158
- // Yetus output
159
- archiveArtifacts " ${ env.PATCHDIR} /**"
160
- // Publish the HTML report so that it can be looked at
161
- // Has to be relative to WORKSPACE.
162
- publishHTML (target : [
163
- allowMissing : true ,
164
- keepAll : true ,
165
- alwaysLinkToLastBuild : true ,
166
- // Has to be relative to WORKSPACE
167
- reportDir : " ${ env.PATCHDIR} " ,
168
- reportFiles : ' report.html' ,
169
- reportName : ' Yetus Report'
170
- ])
171
- // Publish JUnit results
172
- try {
173
- junit " ${ env.SOURCEDIR} /**/target/surefire-reports/*.xml"
174
- } catch (e) {
175
- echo ' junit processing: ' + e. toString()
234
+ // YETUS output
235
+ archiveArtifacts " out/**"
236
+
237
+ // Publish the HTML report so that it can be looked at
238
+ // Has to be relative to WORKSPACE.
239
+ publishHTML (target : [
240
+ allowMissing : true ,
241
+ keepAll : true ,
242
+ alwaysLinkToLastBuild : true ,
243
+ // Has to be relative to WORKSPACE
244
+ reportDir : " out" ,
245
+ reportFiles : ' report.html' ,
246
+ reportName : ' Yetus Report'
247
+ ])
248
+
249
+ // Publish JUnit results
250
+ try {
251
+ junit " ${ SOURCEDIR} /**/target/surefire-reports/*.xml"
252
+ } catch (e) {
253
+ echo ' junit processing: ' + e. toString()
254
+ }
255
+ }
256
+ }
257
+
258
+ cleanup() {
259
+ script {
260
+ sh ''' #!/usr/bin/env bash
261
+
262
+ chmod u+x "${SOURCEDIR}/dev-support/jenkins.sh"
263
+ "${SOURCEDIR}/dev-support/jenkins.sh" cleanup_ci_proc
264
+ '''
265
+ }
266
+ }
176
267
}
177
- }
178
268
}
269
+ }
179
270
271
+ post {
180
272
// Jenkins pipeline jobs fill slaves on PRs without this :(
181
273
cleanup() {
182
274
script {
183
- sh '''
184
- # See YETUS-764
185
- if [ -f "${WORKSPACE}/${PATCHDIR}/pidfile.txt" ]; then
186
- echo "test-patch process appears to still be running: killing"
187
- kill `cat "${WORKSPACE}/${PATCHDIR}/pidfile.txt"` || true
188
- sleep 10
189
- fi
190
- if [ -f "${WORKSPACE}/${PATCHDIR}/cidfile.txt" ]; then
191
- echo "test-patch container appears to still be running: killing"
192
- docker kill `cat "${WORKSPACE}/${PATCHDIR}/cidfile.txt"` || true
193
- fi
194
- # See HADOOP-13951
195
- chmod -R u+rxw "${WORKSPACE}"
196
- '''
275
+ sh ''' #!/usr/bin/env bash
276
+
277
+ # See HADOOP-13951
278
+ chmod -R u+rxw "${WORKSPACE}"
279
+ '''
197
280
deleteDir()
198
281
}
199
282
}
0 commit comments