heptapod-ci: don't run pipelines for topic-less branches stable
authorRaphaël Gomès <rgomes@octobus.net>
Mon, 03 Jul 2023 11:02:36 +0200
branchstable
changeset 50737 429880fd984c
parent 50736 b852c34dc2b8
child 50738 2eaa883778f7
heptapod-ci: don't run pipelines for topic-less branches See inline comment for more details.
contrib/heptapod-ci.yml
--- a/contrib/heptapod-ci.yml	Tue Jun 27 16:19:42 2023 +0200
+++ b/contrib/heptapod-ci.yml	Mon Jul 03 11:02:36 2023 +0200
@@ -1,3 +1,20 @@
+# Don't run pipelines on branch "merge", since we're fast-forward only.
+# Gitlab sees a new branch (since e.g. `topic/stable/my-topic` becomes
+# `branch/stable`), but the hash hasn't changed. There is no reason to
+# re-run the CI in our case, since we haven't built up any specific automation.
+# Right now it's just wasted CI and developer time.
+# One can still run the pipeline manually via the web interface or a push,
+# like in the case of releases, to make *extra* sure that the actual branch
+# has succeeded.
+workflow:
+  rules:
+    - if: $CI_COMMIT_BRANCH =~ /^branch\// && $CI_PIPELINE_SOURCE != "web" && $CI_PIPELINE_SOURCE != "push"
+      when: never
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
+      when: never
+    - if: $CI_COMMIT_BRANCH
+
 stages:
   - tests