From d09dab846dda69f1e2dc9fc309db26d1c77a6f83 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Mon, 23 Oct 2023 22:18:02 -0700 Subject: [PATCH] cancel running into jenkins_lib --- Jenkinsfile | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 653d4a49..8fda206c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,15 +21,7 @@ pipeline { stage('Check and Cancel Old Builds') { steps { script { - def jobName = env.JOB_NAME - def buildNumber = env.BUILD_NUMBER.toInteger() - - // Get all running builds of the current job - def job = Jenkins.instance.getItemByFullName(jobName) - def runningBuilds = job.builds.findAll { it.isBuilding() && it.number < buildNumber } - - // Cancel running builds - runningBuilds.each { it.doStop() } + myCancelRunning.cancelRunning() } } }