From a2a7b20b416c9078e7667eb82f93fae0463748a8 Mon Sep 17 00:00:00 2001
From: Varac <varac@varac.net>
Date: Wed, 16 Jun 2021 21:37:36 +0200
Subject: [PATCH] Deploy from CI container, not from host

---
 .gitlab-ci.yml | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4b0b7a7f2..00c18a452 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -42,6 +42,7 @@ include:
     reports:
       dotenv:
         $CLUSTER_DIR/.cluster.env
+        $CLUSTER_DIR/.env
 
 # Rules that enable the cluster to be built and are applied to most steps
 # (except for application-specific steps)
@@ -306,9 +307,10 @@ setup-openappstack:
     # Set up cluster
     # TODO: I set --no-install-openappstack to skip the old installation procedure, should be removed eventually
     - python3 -m openappstack $HOSTNAME install --install-kubernetes --no-install-openappstack
-    - scp -r ./install root@${FQDN}:/tmp/install
-    - ssh ${FQDN} -l root "/usr/bin/env /tmp/install/ci-write-variable-files.sh $IP_ADDRESS ${FQDN}"
-    - ssh ${FQDN} -l root "/usr/bin/env /tmp/install/install-openappstack.sh"
+    - cp install/.env.example  clusters/${CI_COMMIT_REF_SLUG}/.env
+    - sed "s/1.2.3.4/$IP_ADDRESS/; s/example.org/$FQDN/" clusters/${CI_COMMIT_REF_SLUG}/.env
+    - source clusters/${CI_COMMIT_REF_SLUG}/.env
+    - install/install-openappstack.sh
     # TODO: Should also be removed or made up-to-date
     # Show versions of installed apps/binaries
     # - cd ansible
@@ -426,7 +428,7 @@ single-sign-on-helm-release:
   stage: install-apps
   script:
     - *debug_information
-    - ssh ${FQDN} -l root "/usr/bin/env /tmp/install/install-${APP}.sh"
+    - install/install-${APP}.sh
   extends:
     - .ssh_setup
   interruptible: true
-- 
GitLab