@@ -83,8 +83,11 @@ tvm_multilib_tsim = 'build/libvta_tsim.so, ' +
8383
8484// command to start a docker container
8585docker_run = ' docker/bash.sh'
86+ docker_build = ' docker/build.sh'
8687// timeout in minutes
8788max_time = 240
89+ needs_relint = false
90+ rebuild_docker_images = true
8891
8992def per_exec_ws (folder ) {
9093 return " workspace/exec_${ env.EXECUTOR_NUMBER} /" + folder
@@ -200,11 +203,21 @@ stage('Sanity Check') {
200203 init_git()
201204 is_docs_only_build = sh (
202205 returnStatus : true ,
203- script : ' ./tests/scripts/git_change_docs .sh' ,
206+ script : ' ./tests/scripts/git_change_files .sh docs/ ' ,
204207 label : ' Check for docs only changes' ,
205208 )
206209 skip_ci = should_skip_ci(env. CHANGE_ID )
207210 skip_slow_tests = should_skip_slow_tests(env. CHANGE_ID )
211+ rebuild_docker_images = sh (
212+ returnStatus : true ,
213+ script : ' ./tests/scripts/git_change_files.sh docker/' ,
214+ label : ' Check for docs only changes' ,
215+ )
216+ if (rebuild_docker_images) {
217+ // Exit before linting so we can use the newly created Docker images
218+ // to run the lint
219+ return
220+ }
208221 sh (
209222 script : " ${ docker_run} ${ ci_lint} ./tests/scripts/task_lint.sh" ,
210223 label : ' Run lint' ,
@@ -214,6 +227,100 @@ stage('Sanity Check') {
214227 }
215228}
216229
230+ def build_image (image_name ) {
231+ hash = sh(
232+ returnStdout : true ,
233+ script : ' git log -1 --format=\' %h\' '
234+ ). trim()
235+ hash = " ${ env.BRANCH_NAME} -${ hash} "
236+ sh(
237+ script : " ${ docker_build} ${ image_name} --spec ${ image_name} :${ hash} " ,
238+ label : ' Building docker image'
239+ )
240+ sh " echo NYI: Uploading docker image to registry..."
241+ }
242+
243+ if (rebuild_docker_images) {
244+ stage(' Docker' ) {
245+ // TODO in a follow up PR: Upload to ECR, find tag and use in
246+ // subsequent builds
247+ parallel ' ci-lint' : {
248+ node(' CPU' ) {
249+ timeout(time : max_time, unit : ' MINUTES' ) {
250+ init_git()
251+ build_image(' ci_lint' )
252+ }
253+ }
254+ }, ' ci-cpu' : {
255+ node(' CPU' ) {
256+ timeout(time : max_time, unit : ' MINUTES' ) {
257+ init_git()
258+ build_image(' ci_cpu' )
259+ }
260+ }
261+ }, ' ci-gpu' : {
262+ node(' GPU' ) {
263+ timeout(time : max_time, unit : ' MINUTES' ) {
264+ init_git()
265+ build_image(' ci_gpu' )
266+ }
267+ }
268+ }, ' ci-qemu' : {
269+ node(' CPU' ) {
270+ timeout(time : max_time, unit : ' MINUTES' ) {
271+ init_git()
272+ build_image(' ci_qemu' )
273+ }
274+ }
275+ }, ' ci-i386' : {
276+ node(' CPU' ) {
277+ timeout(time : max_time, unit : ' MINUTES' ) {
278+ init_git()
279+ build_image(' ci_i386' )
280+ }
281+ }
282+ }, ' ci-arm' : {
283+ node(' ARM' ) {
284+ timeout(time : max_time, unit : ' MINUTES' ) {
285+ init_git()
286+ build_image(' ci_arm' )
287+ }
288+ }
289+ }, ' ci-wasm' : {
290+ node(' CPU' ) {
291+ timeout(time : max_time, unit : ' MINUTES' ) {
292+ init_git()
293+ build_image(' ci_wasm' )
294+ }
295+ }
296+ }, ' ci-hexagon' : {
297+ node(' CPU' ) {
298+ timeout(time : max_time, unit : ' MINUTES' ) {
299+ init_git()
300+ build_image(' ci_hexagon' )
301+ }
302+ }
303+ }
304+ }
305+ // // TODO: Once we are able to use the built images, enable this step
306+ // // If the docker images changed, we need to run the image build before the lint
307+ // // can run since it requires a base docker image. Most of the time the images
308+ // // aren't build though so it's faster to use the same node that checks for
309+ // // docker changes to run the lint in the usual case.
310+ // stage('Sanity Check (re-run)') {
311+ // timeout(time: max_time, unit: 'MINUTES') {
312+ // node('CPU') {
313+ // ws(per_exec_ws('tvm/sanity')) {
314+ // init_git()
315+ // sh (
316+ // script: "${docker_run} ${ci_lint} ./tests/scripts/task_lint.sh",
317+ // label: 'Run lint',
318+ // )
319+ // }
320+ // }
321+ // }
322+ // }
323+ }
217324
218325// Run make. First try to do an incremental make from a previous workspace in hope to
219326// accelerate the compilation. If something is wrong, clean the workspace and then
0 commit comments