From a234e82121f976c4ba4bf860eb90ac2a288df1d0 Mon Sep 17 00:00:00 2001 From: Rishabh Singh Date: Thu, 19 Sep 2024 14:54:13 -0700 Subject: [PATCH] Add new stage in gradle-check to check and abort stale runs Signed-off-by: Rishabh Singh --- jenkins/gradle/gradle-check.jenkinsfile | 9 +++++- jenkins/gradle/test-gradle-script.jenkinsfile | 30 ------------------- 2 files changed, 8 insertions(+), 31 deletions(-) delete mode 100644 jenkins/gradle/test-gradle-script.jenkinsfile diff --git a/jenkins/gradle/gradle-check.jenkinsfile b/jenkins/gradle/gradle-check.jenkinsfile index b99af07da5..ff9e1978c8 100644 --- a/jenkins/gradle/gradle-check.jenkinsfile +++ b/jenkins/gradle/gradle-check.jenkinsfile @@ -7,7 +7,7 @@ * compatible open source license. */ -lib = library(identifier: 'jenkins@6.6.0', retriever: modernSCM([ +lib = library(identifier: 'jenkins@6.9.1', retriever: modernSCM([ $class: 'GitSCMSource', remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', ])) @@ -79,6 +79,13 @@ pipeline { BUILD_CAUSE = currentBuild.getBuildCauses() } stages { + stage('Check and abort in-progress runs for same pull-request') { + steps { + script { + abortStaleJenkinsJobs(jobName: 'gradle-check', lookupTime: '3') + } + } + } stage('Run Gradle Check') { steps { script { diff --git a/jenkins/gradle/test-gradle-script.jenkinsfile b/jenkins/gradle/test-gradle-script.jenkinsfile deleted file mode 100644 index a7fcd84bcf..0000000000 --- a/jenkins/gradle/test-gradle-script.jenkinsfile +++ /dev/null @@ -1,30 +0,0 @@ -lib = library(identifier: 'jenkins@6.9.1', retriever: modernSCM([ - $class: 'GitSCMSource', - remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', -])) - -pipeline { - agent {label 'Jenkins-Agent-AL2023-X64-M52xlarge-Benchmark-Test'} - stages { - stage('Set Description') { - steps { - script { - currentBuild.description = "My custom description here" - } - } - } - stage('Stop Old Builds') { - steps { - script { - abortStaleJenkinsJobs(jobName: 'zsngri-gradle-test', lookupTime: '3') - } - } - } - stage('Do Something') { - steps { - echo 'sleeping 300 seconds' - sh 'sleep 300' - } - } - } -}