From d663125ddab593553116ad5e248b9ec47ba5c8b8 Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Mon, 27 Jun 2022 03:01:11 +0200
Subject: [PATCH] ci(gitlab-ci): Reduce automated triggers

This patch reduces the image builds to a minimum stable releases should
only be build then the `.release` file changes, while deb builds can run
on any commit.
---
 images/dovecot/.gitlab-ci.yaml | 8 ++++++--
 images/postfix/.gitlab-ci.yaml | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/images/dovecot/.gitlab-ci.yaml b/images/dovecot/.gitlab-ci.yaml
index 4f53751bb..3035ad642 100644
--- a/images/dovecot/.gitlab-ci.yaml
+++ b/images/dovecot/.gitlab-ci.yaml
@@ -17,7 +17,9 @@ dovecot-container-build:
       .
     - podman push "quay.io/shivering-isles/dovecot:${release}"
   rules:
-    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"'
+      changes:
+        - images/dovecot/.release
 
 dovecot-container-build-dev:
   stage: build
@@ -38,4 +40,6 @@ dovecot-container-build-dev:
       .
     - podman push "quay.io/shivering-isles/dovecot:${CI_COMMIT_SHORT_SHA}"
   rules:
-    - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
+    - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"'
+      changes:
+        - images/dovecot/
diff --git a/images/postfix/.gitlab-ci.yaml b/images/postfix/.gitlab-ci.yaml
index 4704343b8..19fa03737 100644
--- a/images/postfix/.gitlab-ci.yaml
+++ b/images/postfix/.gitlab-ci.yaml
@@ -17,7 +17,9 @@ postfix-container-build:
       .
     - podman push "quay.io/shivering-isles/postfix:${release}"
   rules:
-    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"'
+      changes:
+        - images/postfix/.release
 
 postfix-container-build-dev:
   stage: build
@@ -38,4 +40,6 @@ postfix-container-build-dev:
       .
     - podman push "quay.io/shivering-isles/postfix:${CI_COMMIT_SHORT_SHA}"
   rules:
-    - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
+    - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"'
+      changes:
+        - images/postfix/
-- 
GitLab