You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2020/09/21 00:51:09 UTC

[incubator-tvm] branch master updated: [CI] Cancel previous build if new commit has been pushed to a PR (#6518)

This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git


The following commit(s) were added to refs/heads/master by this push:
     new b4f8b28  [CI] Cancel previous build if new commit has been pushed to a PR (#6518)
b4f8b28 is described below

commit b4f8b287333f9379ac24c07789bd6171a4e4e1ca
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Sun Sep 20 17:49:23 2020 -0700

    [CI] Cancel previous build if new commit has been pushed to a PR (#6518)
---
 Jenkinsfile | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index f6faf25..9e3b0f5 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -92,6 +92,19 @@ def init_git_win() {
     }
 }
 
+def cancel_previous_build() {
+    // cancel previous build if it is not on master.
+    if (env.BRANCH_NAME != "master") {
+        def buildNumber = env.BUILD_NUMBER as int
+        // Milestone API allows us to cancel previous build
+        // with the same milestone number
+        if (buildNumber > 1) milestone(buildNumber - 1)
+        milestone(buildNumber)
+    }
+}
+
+cancel_previous_build()
+
 stage("Sanity Check") {
   timeout(time: max_time, unit: 'MINUTES') {
     node('CPU') {
@@ -112,7 +125,11 @@ def make(docker_type, path, make_flag) {
       sh "${docker_run} ${docker_type} ./tests/scripts/task_build.sh ${path} ${make_flag}"
       // always run cpp test when build
       sh "${docker_run} ${docker_type} ./tests/scripts/task_cpp_unittest.sh"
-    } catch (exc) {
+    } catch (hudson.AbortException ae) {
+      // script exited due to user abort, directly throw instead of retry
+      if (ae.getMessage().contains('script returned exit code 143')) {
+        throw ae
+      }
       echo 'Incremental compilation failed. Fall back to build from scratch'
       sh "${docker_run} ${docker_type} ./tests/scripts/task_clean.sh ${path}"
       sh "${docker_run} ${docker_type} ./tests/scripts/task_build.sh ${path} ${make_flag}"