From 45f9971db113ffed0c986aace003a30a5a59e338 Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Wed, 25 Oct 2023 14:17:15 +0200
Subject: [PATCH] Fix the CI config for the DC branches regexp usage

- Remove RebaseCheckDc job
- Fix regexp usage for DC branches
---
 .gitlab-ci.yml | 45 ++++++---------------------------------------
 1 file changed, 6 insertions(+), 39 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fe28195094..8ab2f473b0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -18,40 +18,7 @@ RebaseCheck:
       - merge_requests
     variables:
       - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
-      - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "/^DC_.*$/"
-  script:
-    # Get the upstream repository manually. I did not find any other way to have it for
-    # comparison
-    # Check if a rebase is needed
-    # If a rebase is needed stop immediately
-    - apk update && apk add git bash
-    - scripts/connect_upstream_repo.sh $CI_MERGE_REQUEST_PROJECT_URL
-    - git fetch upstream
-    - hash1=$(git show-ref upstream/master | cut -f1 -d' ')
-    - hash2=$(git merge-base upstream/master HEAD)
-    - echo "${hash1}"
-    - echo "${hash2}"
-    - if [ "${hash1}" = "${hash2}" ]; then
-    -   echo "No rebase required"
-    -   exit 0
-    - else
-    -   echo "The Merge Request is not up-to-date"
-    -   echo "Rebase is required"
-    -   exit 1
-    - fi
-
-RebaseCheckDc:
-  stage: checkRepository
-  variables:
-    GIT_DEPTH: 200
-  image: alpine
-  tags:
-    - docker
-  only:
-    refs:
-      - merge_requests
-    variables:
-      - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "DC_Oct23"
+      - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^DC_.*$/
   script:
     # Get the upstream repository manually. I did not find any other way to have it for
     # comparison
@@ -85,7 +52,7 @@ LinearHistCheck:
       - merge_requests
     variables:
       - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
-      - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "/^DC_.*$/"
+      - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^DC_.*$/
   script:
     # Get the upstream repository manually. I did not find any other way to have it for
     # comparison
@@ -114,7 +81,7 @@ CodeFormatCheck:
       - merge_requests
     variables:
       - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
-      - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "/^DC_.*$/"
+      - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^DC_.*$/
   script:
     # Get the upstream repository manually. I did not find any other way to have it for
     # comparison
@@ -177,7 +144,7 @@ FileFormatCheck:
       - merge_requests
     variables:
       - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
-      - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "/^DC_.*$/"
+      - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^DC_.*$/
   script:
     # Get the upstream repository manually. I did not find any other way to have it for
     # comparison
@@ -196,7 +163,7 @@ FileEndCheck:
       - merge_requests
     variables:
       - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
-      - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "/^DC_.*$/"
+      - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^DC_.*$/
   script:
     # Get the upstream repository manually. I did not find any other way to have it for
     # comparison
@@ -216,7 +183,7 @@ FileLicenceCheck:
       - merge_requests
     variables:
       - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
-      - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "/^DC_.*$/"
+      - $CI_MERGE_REQUEST_PROJECT_PATH == "computing/cbmroot" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^DC_.*$/
   script:
     # Get the upstream repository manually. I did not find any other way to have it for
     # comparison
-- 
GitLab