From ee0c057434a1a1691922fd6547623db421bdc312 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maik=20Scha=CC=88fer?= <maik.schaefer@open-xchange.com>
Date: Wed, 5 May 2021 16:36:48 +0200
Subject: [PATCH] update gitlab ci

---
 .dockerignore          |  1 +
 .gitlab-ci.yml         | 14 ++++----------
 .gitlab-ci/values.yaml | 15 +++++++++++++++
 3 files changed, 20 insertions(+), 10 deletions(-)
 create mode 100644 .gitlab-ci/values.yaml

diff --git a/.dockerignore b/.dockerignore
index 81bb5d6..0032128 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -8,3 +8,4 @@ docker-compose.yml
 Dockerfile
 README.md
 helm
+.gitlab-ci/
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a120bb8..7708b2b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,18 +4,12 @@ include:
 
 # Helm is used for deploying everything to kubernetes
 # Afterwards we do a rolling restart of our deployment
-deploy:
-  stage: deploy
-  image: dtzar/helm-kubectl
-  tags:
-    - kubernetes
-  script:
-    - envsubst < helm/values/develop.yaml > values.yaml
-    - kubectl create secret docker-registry gitlab-registry-credentials --docker-server=$CI_REGISTRY --docker-username=$GITLAB_DEPLOY_USER --docker-password=$GITLAB_DEPLOY_PASSWORD --dry-run=client -o yaml | kubectl apply -f -
-    - helm upgrade -i manifest-service helm/manifest-service -f values.yaml
-    - kubectl rollout restart deployment manifest-service
+deploy helm chart:
+  extends: .auto-deploy-helm-chart
   environment:
     name: $CI_COMMIT_REF_SLUG
+    on_stop: tear down
+    auto_stop_in: 1 week
     url: https://manifest-$CI_COMMIT_REF_SLUG.k3s.os.oxui.de/
   only:
     - main
diff --git a/.gitlab-ci/values.yaml b/.gitlab-ci/values.yaml
new file mode 100644
index 0000000..ab176f0
--- /dev/null
+++ b/.gitlab-ci/values.yaml
@@ -0,0 +1,15 @@
+replicaCount: 1
+containerPort: 8080
+manifests:
+  - https://manifest-service-dummy.k3s.os.oxui.de/manifest.json
+ingress:
+  enabled: true
+  hosts:
+    - host: manifest-${CI_COMMIT_REF_SLUG}.k3s.os.oxui.de
+      paths:
+        - path: /
+image:
+  tag: main
+  pullPolicy: Always
+imagePullSecrets:
+  - name: gitlab-registry-credentials
-- 
GitLab