.gitlab-ci: Avoid duplicate CI on all merge requests
authorAndrew Bartlett <abartlet@samba.org>
Wed, 13 Oct 2021 19:51:21 +0000 (08:51 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 14 Oct 2021 01:21:11 +0000 (01:21 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14861

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Oct 14 01:21:11 UTC 2021 on sn-devel-184

.gitlab-ci-main.yml

index 4187c7d54fed5dcb8dc1ef3bc8edd3901fa5b155..d876923f9e78b0d894f893f11749a1a2c2f5e897 100644 (file)
@@ -83,7 +83,11 @@ include:
   interruptible: true
   timeout: 2h
 
+  # Otherwise we run twice, once on push and once on MR
+  # https://forum.gitlab.com/t/new-rules-syntax-and-detached-pipelines/37292
   rules:
+    - if: $CI_MERGE_REQUEST_ID
+      when: never
     - when: on_success
 
   variables:
@@ -357,6 +361,10 @@ samba-fips:
   extends: .private_runner_test
   stage: test_private
   rules:
+      # See above, to avoid a duplicate CI on the MR (these rules override the others)
+    - if: $CI_MERGE_REQUEST_ID
+      when: never
+
       # These jobs are only run if the gitlab repo has private runners available.
       # To enable private jobs, you must add the following var and value to
       # your gitlab repo by navigating to:
@@ -517,6 +525,9 @@ ubuntu1804-samba-o3:
     SAMBA_CI_JOB_IMAGE: ${SAMBA_CI_CONTAINER_IMAGE_ubuntu1804}
     SAMBA_CI_AUTOBUILD_ENABLE_COVERAGE: "--enable-coverage"
   rules:
+    # See above, to avoid a duplicate CI on the MR (these rules override the others)
+    - if: $CI_MERGE_REQUEST_ID
+      when: never
     # do not run o3 builds (which run a lot of VMs) if told not to
     # (this uses the same variable as autobuild.py)
     - if: $AUTOBUILD_SKIP_SAMBA_O3 == "1"
@@ -528,6 +539,9 @@ ubuntu1804-samba-o3:
   variables:
     AUTOBUILD_JOB_NAME: samba-o3
   rules:
+    # See above, to avoid a duplicate CI on the MR (these rules override the others)
+    - if: $CI_MERGE_REQUEST_ID
+      when: never
     # do not run o3 builds (which run a lot of VMs) if told not to
     # (this uses the same variable as autobuild.py)
     - if: $AUTOBUILD_SKIP_SAMBA_O3 == "1"