aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-07-14 16:25:55 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-07-14 16:32:00 +0000
commitdafcb52a0d37e0db06669f1c00520d077bd54e9c (patch)
tree73a718c45fac323d3f765a50beac4fd0c34591f8
parent93576825268ffa60055284f3582bcdcc7fba3892 (diff)
tcwg-cancel-scm-builds: New experimental job
Change-Id: Ie3e6d1dae1999ad9d74c0316b913cb47701179d7
-rw-r--r--tcwg-cancel-pollscm-builds.yaml46
-rw-r--r--tcwg/cancel-pollscm-builds.groovy62
-rw-r--r--tcwg_binutils.yaml9
-rw-r--r--tcwg_gnu.yaml.in9
4 files changed, 97 insertions, 29 deletions
diff --git a/tcwg-cancel-pollscm-builds.yaml b/tcwg-cancel-pollscm-builds.yaml
new file mode 100644
index 0000000000..4b774f9a3b
--- /dev/null
+++ b/tcwg-cancel-pollscm-builds.yaml
@@ -0,0 +1,46 @@
+- job:
+ name: tcwg-cancel-pollscm-builds
+ project-type: freestyle
+ defaults: global
+ properties:
+ - authorization:
+ anonymous:
+ - job-read
+ - job-extended-read
+ linaro:
+ - job-build
+ - job-cancel
+ - build-discarder:
+ days-to-keep: 30
+ num-to-keep: 100
+ disabled: false
+ node: tcwg-apm_64-build
+ concurrent: true
+ display-name: 'TCWG ZZZ Cancel PollSCM Builds'
+ scm:
+ - git:
+ url: https://git.linaro.org/toolchain/jenkins-scripts.git
+ refspec: +refs/heads/*:refs/remotes/origin/*
+ branches:
+ - cancel-pollscm-builds
+ basedir: jenkins-scripts
+ skip-tag: true
+ reference-repo: /home/tcwg-buildslave/snapshots-ref/jenkins-scripts.git
+ wipe-workspace: false
+ clean:
+ before: true
+ prune: true
+ triggers:
+ - pollscm:
+ cron: '* * * * *'
+ builders:
+ - groovy:
+ command:
+ !include-raw:
+ - tcwg/cancel-pollscm-builds.groovy
+ - shell:
+ command: |
+ #!/bin/bash
+ set -ex
+
+ sleep 60
diff --git a/tcwg/cancel-pollscm-builds.groovy b/tcwg/cancel-pollscm-builds.groovy
index 73b440e2d7..7ea05e4bc9 100644
--- a/tcwg/cancel-pollscm-builds.groovy
+++ b/tcwg/cancel-pollscm-builds.groovy
@@ -1,16 +1,50 @@
-def cancelPreviousBuilds() {{
- // Check for other instances of this particular build, cancel any that are older than the current one
- def jobName = env.JOB_NAME
- def currentJob = Jenkins.instance.getItemByFullName(jobName)
- def currentBuildNumber = env.BUILD_NUMBER.toInteger()
-
- // Loop through all instances of this particular job/branch
- for (def build : currentJob.builds) {{
- if (build.hasntStartedYet() && (build.number.toInteger() != currentBuildNumber) && (build.GetCauses(Cause.SCMTriggerCause) != null)) {{
- echo "Older build still queued. Sending kill signal to build number: ${{build.number}}"
- build.doStop()
- }}
- }}
-}}
+def cancelPreviousBuilds() {
+ // Check for other instances of this particular build, cancel any that are older than the current one
+ def jobName = env.JOB_NAME;
+ def currentJob = Jenkins.instance.getItemByFullName(jobName);
+ def currentBuildNumber = env.BUILD_NUMBER.toInteger();
+
+ // Loop through all instances of this particular job/branch
+ def stop_myself = false;
+ def keep_scm_build = 0;
+
+ println("DEBUG: Scanning");
+ for (def build : currentJob.builds) {
+ if (!build.hasntStartedYet() && build.number.toInteger() != currentBuildNumber) {
+ continue;
+ }
+
+ if (build.GetCauses(Cause.SCMTriggerCause) != null) {
+ if (keep_scm_build < build.number.toInteger()) {
+ keep_scm_build = build.number.toInteger();
+ }
+ } else {
+ keep_scm_build = 0;
+ }
+ }
+
+ println("DEBUG: keep_scm_build #${keep_scm_build}");
+
+ def killCurrentBuild = null;
+ for (def build : currentJob.builds) {
+ if (!build.hasntStartedYet() && build.number.toInteger() != currentBuildNumber) {
+ continue;
+ }
+
+ if (build.GetCauses(Cause.SCMTriggerCause) != null && build.number.toInteger() != keep_scm_build) {
+ if (build.number.toInteger() != currentBuildNumber) {
+ println("DEBUG: Stopping SCM build #${build.number.toInteger()}");
+ build.doStop();
+ } else {
+ killCurrentBuild = build;
+ }
+ }
+ }
+
+ if (killCurrentBuild != null) {
+ println("DEBUG: Stopping SCM self #${killCurrentBuild.number.toInteger()}");
+ killCurrentBuild.doStop();
+ }
+}
cancelPreviousBuilds()
diff --git a/tcwg_binutils.yaml b/tcwg_binutils.yaml
index 8c7bbe7258..cfefece210 100644
--- a/tcwg_binutils.yaml
+++ b/tcwg_binutils.yaml
@@ -22,8 +22,7 @@
disabled: false
cron: 'H H/12 * * *'
type_of_test:
- - check_binutils:
- cron: '*/2 * * * *'
+ - check_binutils
jobs:
- 'tcwg_binutils-build-{toolchain_name}-{toolchain_ver}-{target}-{type_of_test}'
- 'tcwg_binutils-bisect-{toolchain_name}-{toolchain_ver}-{target}-{type_of_test}'
@@ -429,10 +428,6 @@
- build-wrappers:
timeout: 1000
builders:
- - groovy:
- command:
- !include-raw:
- - tcwg/cancel-pollscm-builds.groovy
- run-build:
build_script: 'tcwg_gnu-build.sh'
components: 'binutils'
@@ -482,4 +477,4 @@
docker_arch: '{docker_arch}'
publishers:
- bisect-publishers
-# checksum: f451e8ca233dd1fedb0f21225cf0f8e5
+# checksum: 33201f1e748947379988db66bd9f3503
diff --git a/tcwg_gnu.yaml.in b/tcwg_gnu.yaml.in
index 02ee767b0e..266cc3bdbf 100644
--- a/tcwg_gnu.yaml.in
+++ b/tcwg_gnu.yaml.in
@@ -65,8 +65,7 @@
cron: 'H H/12 * * *'
type_of_test:
#if RR_tcwg_binutils
- - check_binutils:
- cron: '*/2 * * * *'
+ - check_binutils
#elif RR_tcwg_cross
- build_cross
- check_cross
@@ -152,12 +151,6 @@
- build-wrappers:
timeout: 1000
builders:
-#if RR_tcwg_binutils
- - groovy:
- command:
- !include-raw:
- - tcwg/cancel-pollscm-builds.groovy
-#endif
- run-build:
build_script: 'tcwg_gnu-build.sh'
components: '#{COMPONENTS}'