From a5c3805f3c68c623859506833274451b7e511a06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=BCrgen=20Haas?= <juergen.haas@lakedrops.com>
Date: Fri, 17 Apr 2020 16:46:10 +0200
Subject: [PATCH] Include all CI jobs into the main template

---
 .gitlab-ci-template.yml | 43 ++++++++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 11 deletions(-)

diff --git a/.gitlab-ci-template.yml b/.gitlab-ci-template.yml
index ca69018..3ed3db4 100644
--- a/.gitlab-ci-template.yml
+++ b/.gitlab-ci-template.yml
@@ -2,29 +2,50 @@ stages:
   - build
   - deploy
 
-build-docker-image:
-  stage: build
-  script:
+.default_settings_docker: &default_settings_docker
+  before_script:
     - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
-    - docker build --pull -t "$CI_REGISTRY_IMAGE" .
-    - docker push "$CI_REGISTRY_IMAGE"
   only:
     - master
     - chat
   except:
     - schedules
+  
+.default_settings_cron: &default_settings_cron
+  stage: deploy
+  tags:
+    - ansible
+  variables:
+    GIT_STRATEGY: none
+  only:
+    refs:
+      - chat
+      - schedules
+    variables:
+      - $ANSIBLE_JOB_NAME
+      - $ANSIBLE_EXTRA_ARGS
 
-update-docker-image:
+BuildDockerImage:
+  <<: *default_settings_docker
+  stage: build
+  script:
+    - docker build --pull -t "$CI_REGISTRY_IMAGE" .
+    - docker push "$CI_REGISTRY_IMAGE"
+
+UpdateDockerImage:
+  <<: *default_settings_docker
   stage: deploy
   tags:
     - ansible-update
   variables:
     GIT_STRATEGY: none
   script:
-    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
     - docker pull "$CI_REGISTRY_IMAGE"
-  only:
-    - master
-    - chat
+
+RenewLetsEncrypt:
+  <<: *default_settings_cron
+  script:
+    - ascr role letsencrypt --tags=renew ${CHAT_INPUT} ${ANSIBLE_EXTRA_ARGS}
   except:
-    - schedules
+    variables:
+      - $ANSIBLE_JOB_NAME != "RenewLetsEncrypt"
-- 
GitLab