From fb59631f879faf7c286f772fdcbc0f38042a0194 Mon Sep 17 00:00:00 2001
From: Jorge Camarero Vera <jorge.camarero@cern.ch>
Date: Thu, 18 Aug 2022 18:14:22 +0200
Subject: [PATCH] Resolve "CI should cancel running jobs for a branch after a
 force push"

---
 .gitlab-ci.yml  | 28 +++++++++++++++-------------
 ReleaseNotes.md |  1 +
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 99a78db863..c861bcfffe 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -50,19 +50,21 @@ variables:
       CMAKE_OPTIONS="-DDISABLE_ORACLE_SUPPORT:BOOL=ON";
     fi
 
-before_script:
-  - export CTA_BUILD_ID=${CI_PIPELINE_ID}git${CI_COMMIT_SHA:0:8}
-  - echo "Exporting CTA_BUILD_ID=${CTA_BUILD_ID}"
-  - test -n "${CI_COMMIT_TAG}" && export TAG_VERSION=$(echo ${CI_COMMIT_TAG} | sed -e 's/^v//;s/-.*$//')
-  - test -n "${CI_COMMIT_TAG}" && export TAG_RELEASE=$(echo ${CI_COMMIT_TAG} | sed -e 's/^[^-]*-//')
-  - major_version=$(echo ${TAG_VERSION} | cut -d. -f1)
-  - if [[ ${major_version} == 5 ]];
-      then echo "Setting to compile with XRootD version 5";
-      XROOTD_VERSION=5;
-    fi
-  - *prepare-xrootd5
-  - *prepare-scheduler-type
-  - *prepare-no-oracle
+default:
+  interruptible: true
+  before_script:
+    - export CTA_BUILD_ID=${CI_PIPELINE_ID}git${CI_COMMIT_SHA:0:8}
+    - echo "Exporting CTA_BUILD_ID=${CTA_BUILD_ID}"
+    - test -n "${CI_COMMIT_TAG}" && export TAG_VERSION=$(echo ${CI_COMMIT_TAG} | sed -e 's/^v//;s/-.*$//')
+    - test -n "${CI_COMMIT_TAG}" && export TAG_RELEASE=$(echo ${CI_COMMIT_TAG} | sed -e 's/^[^-]*-//')
+    - major_version=$(echo ${TAG_VERSION} | cut -d. -f1)
+    - if [[ ${major_version} == 5 ]];
+        then echo "Setting to compile with XRootD version 5";
+        XROOTD_VERSION=5;
+      fi
+    - *prepare-xrootd5
+    - *prepare-scheduler-type
+    - *prepare-no-oracle
 
 include:
   - local: .gitlab/ci/*.gitlab-ci.yml
diff --git a/ReleaseNotes.md b/ReleaseNotes.md
index 8715837711..5887a740ff 100644
--- a/ReleaseNotes.md
+++ b/ReleaseNotes.md
@@ -7,6 +7,7 @@
 - cta/CTA#7  - Use same versionlock.list file for xrootd4 and 5
 - cta/CTA#18 - CI - Testing of DB schema upgrade script
 - cta/CTA#49 - Clean up orchestration test scripts
+- cta/CTA#101 - CI should cancel running jobs for a branch after a force push
 ### Building and Packaging
 - cta/CTA#92 - Refactor CTA code so that it can be build without Oracle dependencies
 
-- 
GitLab