Abort previous builds on PR update (#2877)
This commit is contained in:
parent
1c6772a9fc
commit
4085785d73
20
.ci/openvino-onnx/Jenkinsfile
vendored
20
.ci/openvino-onnx/Jenkinsfile
vendored
@ -4,6 +4,25 @@
|
|||||||
DOCKER_CONTAINER_NAME= "openvino-onnx-ci-container"
|
DOCKER_CONTAINER_NAME= "openvino-onnx-ci-container"
|
||||||
DOCKER_IMAGE_TAG = "openvino-onnx-ci-image"
|
DOCKER_IMAGE_TAG = "openvino-onnx-ci-image"
|
||||||
|
|
||||||
|
// workaround for aborting previous builds on PR update
|
||||||
|
@NonCPS
|
||||||
|
def stopPreviousRunningBuilds() {
|
||||||
|
def jobname = env.JOB_NAME
|
||||||
|
if (jobname.startsWith("onnx/openvino_ci/PR")){
|
||||||
|
def buildnum = env.BUILD_NUMBER.toInteger()
|
||||||
|
def job = Jenkins.instance.getItemByFullName(jobname)
|
||||||
|
def job_newest = job.builds.first()
|
||||||
|
for (build in job.builds.reverse()[0..<-1]) {
|
||||||
|
if (build.isBuilding()){
|
||||||
|
echo "Stop task = ${build} because newest #${job_newest} is on the way"
|
||||||
|
build.doStop();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
def getGitPrInfo(String project) {
|
def getGitPrInfo(String project) {
|
||||||
def gitPrInfo = [
|
def gitPrInfo = [
|
||||||
prAuthorEmail : "",
|
prAuthorEmail : "",
|
||||||
@ -90,6 +109,7 @@ pipeline {
|
|||||||
stages {
|
stages {
|
||||||
stage("Clone repository") {
|
stage("Clone repository") {
|
||||||
steps{
|
steps{
|
||||||
|
stopPreviousRunningBuilds()
|
||||||
dir("${WORKDIR}") {
|
dir("${WORKDIR}") {
|
||||||
checkout scm
|
checkout scm
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user