From c85d8b5cfbe349413b8d678e547522ae51af1346 Mon Sep 17 00:00:00 2001
From: Christian Boettcher <c.boettcher@fz-juelich.de>
Date: Fri, 3 Sep 2021 07:42:36 +0200
Subject: [PATCH] add sudo to mount commands

---
 .gitlab-ci.yml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d44a342..bdf6733 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -92,7 +92,8 @@ full-deploy-production:
     - sleep 10 # ensure that next command reaches the new server, prevents host key problems
     # TODO move local zip of certificate-docker-volume to server once startup is complete
     - openstack server add volume $INSTANCE_ID $VOLUME_ID
-    - ssh -oStrictHostKeyChecking=accept-new apiserver@$PRODUCTION_DOMAIN "mount /dev/vdb1 /app/mnt"
+    - ssh -oStrictHostKeyChecking=accept-new apiserver@$PRODUCTION_DOMAIN "sudo mkdir -p /app/mnt"
+    - ssh -oStrictHostKeyChecking=accept-new apiserver@$PRODUCTION_DOMAIN "sudo mount /dev/vdb1 /app/mnt"
     - until ssh -oStrictHostKeyChecking=accept-new apiserver@$PRODUCTION_DOMAIN ls /finished_cloudinit >/dev/null 2>&1; do sleep 30; done # wait until cloudinit script is complete
 
 full-deploy-testing:
@@ -148,7 +149,7 @@ cleanup-failed-full-deployment:
       openstack server remove volume $REMOVE_ID $VOLUME_ID || "No Volume was removed.";
       openstack server delete $REMOVE_ID && echo "Deleted faulty production server." || "No faulty production was deleted.";
       openstack server add volume $OLD_PROD_ID $VOLUME_ID;
-      ssh -oStrictHostKeyChecking=accept-new apiserver@$PRODUCTION_DOMAIN "mount /dev/vdb1 /app/mnt";
+      ssh -oStrictHostKeyChecking=accept-new apiserver@$PRODUCTION_DOMAIN "sudo mount /dev/vdb1 /app/mnt";
       fi
     # gitlab should automatically alert the devs about this failure
 
-- 
GitLab