From 993cd4d479e4ccac7679d4f5a27b10bb7fe5db34 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sat, 23 Oct 2021 23:59:07 +0300
Subject: [PATCH] CI templates.

- Use the containerfiles templates.
- The repo was renamed as part of a refactor.
---
 .gitlab-ci.yml | 69 +++++++++++---------------------------------------
 1 file changed, 15 insertions(+), 54 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 70b29e8..72077fe 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,60 +1,21 @@
 ---
 include:
-  - project: shore/ci-templates
+  - project: shore/ci-stuff
     file: templates/pre-commit.yml
-  - project: shore/ci-templates
+  - project: shore/ci-stuff
     file: templates/notify.yml
-
-stages:
-  - test
-  - build
-  - deploy
-
-# One day I may want to start tagging release and for that the TAG variable is
-# needed, but that would mean releasing ALL of the images when tagging (sort of
-# a periodic release). The images are not really related so for now TAG is
-# hard-coded to latest.
-variables:
-  TAG: latest
-
-# Job templates:
-
-.build:
-  stage: build
-  variables:
-    DOCKER_BUILDKIT: "1"
-  tags: &tags [ns4.shore.co.il]
-  script:
-    - docker build --pull --no-cache --iidfile iid "$CONTEXT"
-  after_script:
-    - echo "HASH=$(cat iid)" > dot.env
-  artifacts:
-    reports:
-      dotenv: dot.env
-  rules: &rules
-    - if: $CI_PIPELINE_SOURCE == "schedule"
-    - if: $CI_PIPELINE_SOURCE == "push"
-      changes:
-        - $CONTEXT/*
-        - $CONTEXT/**/*
-
-.push:
-  stage: deploy
-  tags: *tags
-  script:
-    - docker tag "$HASH" "registry.shore.co.il/$IMAGE:${TAG:-latest}"
-    - docker push "registry.shore.co.il/$IMAGE:${TAG:-latest}"
-  rules: *rules
+  - project: shore/ci-stuff
+    file: templates/containerfiles.yml
 
 # cgit image:
 
 build-cgit:
-  extends: .build
+  extends: .container-build
   variables:
     CONTEXT: cgit
 
 push-cgit:
-  extends: .push
+  extends: .container-push
   variables:
     CONTEXT: cgit
     IMAGE: cgit
@@ -65,12 +26,12 @@ push-cgit:
 # httpd latest image:
 
 build-httpd:
-  extends: .build
+  extends: .container-build
   variables:
     CONTEXT: httpd/buster
 
 push-httpd:
-  extends: .push
+  extends: .container-push
   variables:
     CONTEXT: httpd/buster
     IMAGE: httpd
@@ -81,7 +42,7 @@ push-httpd:
 # httpd buster image:
 
 push-httpd-buster:
-  extends: .push
+  extends: .container-push
   variables:
     CONTEXT: httpd/buster
     IMAGE: httpd
@@ -93,12 +54,12 @@ push-httpd-buster:
 # httpd bullseye image:
 
 build-httpd-bullseye:
-  extends: .build
+  extends: .container-build
   variables:
     CONTEXT: httpd/bullseye
 
 push-httpd-bullseye:
-  extends: .push
+  extends: .container-push
   variables:
     CONTEXT: httpd/bullseye
     IMAGE: httpd
@@ -110,13 +71,13 @@ push-httpd-bullseye:
 # sshd image:
 
 build-sshd:
-  extends: .build
+  extends: .container-build
   variables:
     CONTEXT: sshd
     DOCKER_BUILDKIT: ""
 
 push-sshd:
-  extends: .push
+  extends: .container-push
   variables:
     CONTEXT: sshd
     IMAGE: sshd
@@ -127,12 +88,12 @@ push-sshd:
 # crond image:
 
 build-crond:
-  extends: .build
+  extends: .container-build
   variables:
     CONTEXT: crond
 
 push-crond:
-  extends: .push
+  extends: .container-push
   variables:
     CONTEXT: crond
     IMAGE: cron
-- 
GitLab