Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Revert "Kill running PR builds when a new build is triggered for the …
Browse files Browse the repository at this point in the history
…same PR (#8034)" (#8078)

This reverts commit 4c0df62.
  • Loading branch information
mbaijal authored and nswamy committed Sep 28, 2017
1 parent 3059030 commit 0449cc6
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,14 @@ max_time = 120
// assign any caught errors here
err = null

//Method to Kill old PR Builds that are running currently when a new build is triggered.
//env.JOB_NAME looks something like "incubator-mxnet/PR-7893". Thus, projectName is incubator-mxnet
//env.JOB_BASE_NAME is either the name of the branch or for a PR something like "PR-7893"
//Once the project and the current PR (or branch) is known, search for all builds within it.
//Abort the build if it is older than the current build.
def abortPreviousRunningBuilds() {
def hudsonInstance = Hudson.instance
def projectName = env.JOB_NAME.split('/')[0]

hudsonInstance.getItem(projectName).getItem(env.JOB_BASE_NAME).getBuilds().each{ build ->
def exec = build.getExecutor()

if (build.number < currentBuild.number && exec != null) {
exec.interrupt(
Result.ABORTED,
new CauseOfInterruption.UserInterruption(
"Aborted by #${currentBuild.number}"
)
)
println("Aborted previous running build #${build.number}")
}
}
}

// initialize source codes
def init_git() {
retry(5) {
try {
timeout(time: 2, unit: 'MINUTES') {
checkout scm
sh 'git submodule update --init'
sh 'git clean -d -f'
sh 'git clean -d -f'
}
} catch (exc) {
deleteDir()
Expand All @@ -58,7 +34,7 @@ def init_git_win() {
timeout(time: 2, unit: 'MINUTES') {
checkout scm
bat 'git submodule update --init'
bat 'git clean -d -f'
bat 'git clean -d -f'
}
} catch (exc) {
deleteDir()
Expand Down Expand Up @@ -143,9 +119,6 @@ try {
stage("Sanity Check") {
timeout(time: max_time, unit: 'MINUTES') {
node('mxnetlinux') {
if (env.BRANCH_NAME != "master") {
abortPreviousRunningBuilds()
}
ws('workspace/sanity') {
init_git()
sh "python tools/license_header.py check"
Expand Down

0 comments on commit 0449cc6

Please sign in to comment.