From 489ed11efdcc153fc0165efb90e7ba7ea7d7033f Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Sun, 26 Jun 2022 01:47:55 +0200
Subject: [PATCH] ci(gitlab-ci): Add temporary gitlab CI in place

This patch adds a gitlab-ci integration while tekton is still in the
works. This should build all images required, while keeping the door
open for switching to tekton soon.
---
 .gitlab-ci.yml                 |  3 +++
 images/dovecot/.gitlab-ci.yaml | 41 ++++++++++++++++++++++++++++++++++
 images/postfix/.gitlab-ci.yaml | 41 ++++++++++++++++++++++++++++++++++
 3 files changed, 85 insertions(+)
 create mode 100644 images/dovecot/.gitlab-ci.yaml
 create mode 100644 images/postfix/.gitlab-ci.yaml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7c0aade41..357211c19 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,9 @@
 ---
+include:
+  - local: 'images/**/.gitlab-ci.yaml'
 stages:
   - release
+  - build
 
 
 # Automated month-based releases
diff --git a/images/dovecot/.gitlab-ci.yaml b/images/dovecot/.gitlab-ci.yaml
new file mode 100644
index 000000000..4f53751bb
--- /dev/null
+++ b/images/dovecot/.gitlab-ci.yaml
@@ -0,0 +1,41 @@
+dovecot-container-build:
+  stage: build
+  image: quay.io/sheogorath/build-ah-engine:2.0.0
+  before_script:
+    - podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
+  script:
+    - |
+      cd images/dovecot
+      source .release
+      podman build --pull \
+      --label "org.opencontainers.image.source=$CI_PROJECT_URL/-/tree/$CI_COMMIT_SHA/images/dovecot" \
+      --label "org.opencontainers.image.revision=$CI_COMMIT_SHA" \
+      --label "org.opencontainers.image.created=$(date --rfc-3339 ns)" \
+      --label "org.opencontainers.image.title=dovecot" \
+      -t "quay.io/shivering-isles/dovecot:${release}" \
+      --format docker \
+      .
+    - podman push "quay.io/shivering-isles/dovecot:${release}"
+  rules:
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+
+dovecot-container-build-dev:
+  stage: build
+  image: quay.io/sheogorath/build-ah-engine:2.0.0
+  before_script:
+    - podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
+  script:
+    - |
+      cd images/dovecot
+      podman build --pull \
+      --label "org.opencontainers.image.source=$CI_PROJECT_URL/-/tree/$CI_COMMIT_SHA/images/dovecot" \
+      --label "org.opencontainers.image.revision=$CI_COMMIT_SHA" \
+      --label "org.opencontainers.image.created=$(date --rfc-3339 ns)" \
+      --label "org.opencontainers.image.title=$CI_PROJECT_TITLE" \
+      --label "quay.expires-after=12w" \
+      -t "quay.io/shivering-isles/dovecot:${CI_COMMIT_SHORT_SHA}" \
+      --format docker \
+      .
+    - podman push "quay.io/shivering-isles/dovecot:${CI_COMMIT_SHORT_SHA}"
+  rules:
+    - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
diff --git a/images/postfix/.gitlab-ci.yaml b/images/postfix/.gitlab-ci.yaml
new file mode 100644
index 000000000..e5b1b16bf
--- /dev/null
+++ b/images/postfix/.gitlab-ci.yaml
@@ -0,0 +1,41 @@
+postfix-container-build:
+  stage: build
+  image: quay.io/sheogorath/build-ah-engine:2.0.0
+  before_script:
+    - podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
+  script:
+    - |
+      cd images/postfix
+      source .release
+      podman build --pull \
+      --label "org.opencontainers.image.source=$CI_PROJECT_URL/-/tree/$CI_COMMIT_SHA/images/postfix" \
+      --label "org.opencontainers.image.revision=$CI_COMMIT_SHA" \
+      --label "org.opencontainers.image.created=$(date --rfc-3339 ns)" \
+      --label "org.opencontainers.image.title=$CI_PROJECT_TITLE" \
+      -t "quay.io/shivering-isles/postfix:${release}" \
+      --format docker \
+      .
+    - podman push "quay.io/shivering-isles/postfix:${release}"
+  rules:
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+
+postfix-container-build-dev:
+  stage: build
+  image: quay.io/sheogorath/build-ah-engine:2.0.0
+  before_script:
+    - podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
+  script:
+    - |
+      cd images/dovecot
+      podman build --pull \
+      --label "org.opencontainers.image.source=$CI_PROJECT_URL/-/tree/$CI_COMMIT_SHA/images/postfix" \
+      --label "org.opencontainers.image.revision=$CI_COMMIT_SHA" \
+      --label "org.opencontainers.image.created=$(date --rfc-3339 ns)" \
+      --label "org.opencontainers.image.title=$CI_PROJECT_TITLE" \
+      --label "quay.expires-after=12w" \
+      -t "quay.io/shivering-isles/postfix:${CI_COMMIT_SHORT_SHA}" \
+      --format docker \
+      .
+    - podman push "quay.io/shivering-isles/postfix:${CI_COMMIT_SHORT_SHA}"
+  rules:
+    - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
-- 
GitLab