Skip to content

Commit 70a9bcd

Browse files
committed
Fix condition type
1 parent 114188a commit 70a9bcd

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

Jenkinsfile

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,15 @@ def should_skip_ci(pr_number) {
122122
credentialsId: 'tvm-bot-jenkins-reader',
123123
variable: 'TOKEN',
124124
)]) {
125-
run_full_ci = sh (
125+
// Exit code of 1 means run full CI (or the script had an error, so run
126+
// full CI just in case). Exit code of 0 means skip CI.
127+
git_skip_ci_code = sh (
126128
returnStatus: true,
127129
script: "./tests/scripts/git_skip_ci.py --pr '${pr_number}'",
128130
label: 'Check if CI should be skipped',
129131
)
130132
}
131-
return !run_full_ci
133+
return git_skip_ci_code == 0
132134
}
133135

134136
cancel_previous_build()
@@ -257,7 +259,7 @@ def cpp_unittest(image) {
257259

258260
stage('Build') {
259261
parallel 'BUILD: GPU': {
260-
if (skip_ci != 1) {
262+
if (!skip_ci) {
261263
node('GPUBUILD') {
262264
ws(per_exec_ws('tvm/build-gpu')) {
263265
init_git()
@@ -272,7 +274,7 @@ stage('Build') {
272274
}
273275
},
274276
'BUILD: CPU': {
275-
if (skip_ci != 1 && is_docs_only_build != 1) {
277+
if (!skip_ci && is_docs_only_build != 1) {
276278
node('CPU') {
277279
ws(per_exec_ws('tvm/build-cpu')) {
278280
init_git()
@@ -302,7 +304,7 @@ stage('Build') {
302304
}
303305
},
304306
'BUILD: WASM': {
305-
if (skip_ci != 1 && is_docs_only_build != 1) {
307+
if (!skip_ci && is_docs_only_build != 1) {
306308
node('CPU') {
307309
ws(per_exec_ws('tvm/build-wasm')) {
308310
init_git()
@@ -325,7 +327,7 @@ stage('Build') {
325327
}
326328
},
327329
'BUILD: i386': {
328-
if (skip_ci != 1 && is_docs_only_build != 1) {
330+
if (!skip_ci && is_docs_only_build != 1) {
329331
node('CPU') {
330332
ws(per_exec_ws('tvm/build-i386')) {
331333
init_git()
@@ -342,7 +344,7 @@ stage('Build') {
342344
}
343345
},
344346
'BUILD: arm': {
345-
if (skip_ci != 1 && is_docs_only_build != 1) {
347+
if (!skip_ci && is_docs_only_build != 1) {
346348
node('ARM') {
347349
ws(per_exec_ws('tvm/build-arm')) {
348350
init_git()
@@ -359,7 +361,7 @@ stage('Build') {
359361
}
360362
},
361363
'BUILD: QEMU': {
362-
if (skip_ci != 1 && is_docs_only_build != 1) {
364+
if (!skip_ci && is_docs_only_build != 1) {
363365
node('CPU') {
364366
ws(per_exec_ws('tvm/build-qemu')) {
365367
init_git()
@@ -386,7 +388,7 @@ stage('Build') {
386388

387389
stage('Unit Test') {
388390
parallel 'python3: GPU': {
389-
if (skip_ci != 1 && is_docs_only_build != 1) {
391+
if (!skip_ci && is_docs_only_build != 1) {
390392
node('TensorCore') {
391393
ws(per_exec_ws('tvm/ut-python-gpu')) {
392394
init_git()
@@ -414,7 +416,7 @@ stage('Unit Test') {
414416
}
415417
},
416418
'python3: CPU': {
417-
if (skip_ci != 1 && is_docs_only_build != 1) {
419+
if (!skip_ci && is_docs_only_build != 1) {
418420
node('CPU') {
419421
ws(per_exec_ws("tvm/ut-python-cpu")) {
420422
init_git()
@@ -434,7 +436,7 @@ stage('Unit Test') {
434436
}
435437
},
436438
'python3: i386': {
437-
if (skip_ci != 1 && is_docs_only_build != 1) {
439+
if (!skip_ci && is_docs_only_build != 1) {
438440
node('CPU') {
439441
ws(per_exec_ws('tvm/ut-python-i386')) {
440442
init_git()
@@ -456,7 +458,7 @@ stage('Unit Test') {
456458
}
457459
},
458460
'python3: arm': {
459-
if (skip_ci != 1 && is_docs_only_build != 1) {
461+
if (!skip_ci && is_docs_only_build != 1) {
460462
node('ARM') {
461463
ws(per_exec_ws('tvm/ut-python-arm')) {
462464
init_git()
@@ -478,7 +480,7 @@ stage('Unit Test') {
478480
}
479481
},
480482
'java: GPU': {
481-
if (skip_ci != 1 && is_docs_only_build != 1 ) {
483+
if (!skip_ci && is_docs_only_build != 1 ) {
482484
node('GPU') {
483485
ws(per_exec_ws('tvm/ut-java')) {
484486
init_git()
@@ -500,7 +502,7 @@ stage('Unit Test') {
500502

501503
stage('Integration Test') {
502504
parallel 'topi: GPU': {
503-
if (skip_ci != 1 && is_docs_only_build != 1) {
505+
if (!skip_ci && is_docs_only_build != 1) {
504506
node('GPU') {
505507
ws(per_exec_ws('tvm/topi-python-gpu')) {
506508
init_git()
@@ -520,7 +522,7 @@ stage('Integration Test') {
520522
}
521523
},
522524
'frontend: GPU': {
523-
if (skip_ci != 1 && is_docs_only_build != 1) {
525+
if (!skip_ci && is_docs_only_build != 1) {
524526
node('GPU') {
525527
ws(per_exec_ws('tvm/frontend-python-gpu')) {
526528
init_git()
@@ -540,7 +542,7 @@ stage('Integration Test') {
540542
}
541543
},
542544
'frontend: CPU': {
543-
if (skip_ci != 1 && is_docs_only_build != 1) {
545+
if (!skip_ci && is_docs_only_build != 1) {
544546
node('CPU') {
545547
ws(per_exec_ws('tvm/frontend-python-cpu')) {
546548
init_git()
@@ -560,7 +562,7 @@ stage('Integration Test') {
560562
}
561563
},
562564
'docs: GPU': {
563-
if (skip_ci != 1) {
565+
if (!skip_ci) {
564566
node('TensorCore') {
565567
ws(per_exec_ws('tvm/docs-python-gpu')) {
566568
init_git()

tests/scripts/git_skip_ci.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@ def check_pr_title():
8888
print("pr title:", pr["title"])
8989
return pr["title"].startswith("[skip ci]")
9090

91-
if args.pr != "null" and branch != "main" and log.startswith("[skip ci]") and check_pr_title():
91+
if (
92+
args.pr != "null"
93+
and args.pr.strip() != ""
94+
and branch != "main"
95+
and log.startswith("[skip ci]")
96+
and check_pr_title()
97+
):
9298
print("Commit and PR start with '[skip ci]', skipping...")
9399
exit(0)
94100
else:

0 commit comments

Comments
 (0)