From d6f779765755f0a012541011c4809d57f0ab7b66 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Fri, 7 May 2021 15:48:35 +0200
Subject: [PATCH] stop if download fails; export IMLCI variables (needed on
 Debian10)

---
 bin/getfile.sh | 3 ++-
 deploy_app.sh  | 4 ++++
 readme.md      | 4 ++--
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/bin/getfile.sh b/bin/getfile.sh
index 381db6c..db49400 100755
--- a/bin/getfile.sh
+++ b/bin/getfile.sh
@@ -163,6 +163,7 @@ ${apiTS}
         fi
     else
         echo ERROR: Download failed.
+        exit 1
     fi
   else
     curl\
@@ -287,4 +288,4 @@ if [ "$IMLCI_FILE" = "ALL" ]; then
     done
 else 
     makeRequest GET "/packages/$IMLCI_PHASE/$IMLCI_PROJECT/$IMLCI_FILE" "$IMLCI_OUTFILE" "$IMLCI_PKG_SECRET"
-fi
\ No newline at end of file
+fi
diff --git a/deploy_app.sh b/deploy_app.sh
index 393f27d..d1d1e01 100755
--- a/deploy_app.sh
+++ b/deploy_app.sh
@@ -20,6 +20,10 @@ tmpdir=/var/tmp/imldeployment_packages
 wait=0
 # wait=1
 
+# export variables that will be set in getfile config or project
+export IMLCI_PROJECT=TODO
+export IMLCI_PHASE=TODO
+
 
 # ----------------------------------------------------------------------
 # FUNCTIONS
diff --git a/readme.md b/readme.md
index 77cc4d5..6dbb028 100644
--- a/readme.md
+++ b/readme.md
@@ -80,13 +80,13 @@ cleanup_force=0
 
 Config variables:
 
-name            | type   | description 
+name            | type   | description
 ---             | ---    | ---
 installdir      | string | target directory of your application
 appowner        | string | if not empty a chown -R will be applied in target directory by `chwon -R ${appowner} ${installdir}`; appowner is the parameter behind -R. It is something like "myuser." or "myuser:mygroup". For a web application it should be the user of your webservice (www-data/ apache/ nginx). The command chown requires to run the deploy script as root.
 IMLCI_PROJECT   | string | Project id in IML CI server
 IMLCI_PHASE     | string | optional: override the global IMLCI_PHASE in ./bin/getfile.sh.cfg; it is one of preview\|stage\|live
-cleanup_preview | 0 or 1 | Cleanup preview - shows diff between downloaded TGZ and ${installdir}. 
+cleanup_preview | 0 or 1 | Cleanup preview - shows diff between downloaded TGZ and ${installdir}.
 cleanup_force   | 0 or 1 | Run cleanup: it deletes all files in target directory that aren't in the last downloaded tgz. To keep runtime data like logs or uploads you can add a file `.keep` in the directory.
 
 Make a testrun: `./deploy_app.sh` in application root.
-- 
GitLab