]> git.immae.eu Git - github/fretlink/ansible-clever.git/blobdiff - tests/fake.sh
deploy: try to restart the app when the CLI asks to do it
[github/fretlink/ansible-clever.git] / tests / fake.sh
index 65ff819ffd4b538c71d5dc91ed89829dc9fbf673..776907b7ac36a405cdcf59fe82045114fed71b90 100755 (executable)
@@ -3,6 +3,9 @@
 binary="${0/*\/}"
 localCommit="${PRETEND_LOCAL_COMMIT:-aaa000aaa000aaa000aaa000aaa000aaa000aaa0}"
 remoteCommit="${PRETEND_REMOTE_COMMIT:-bbb000bbb000bbb000bbb000bbb000bbb000bbb0}"
+uptodateDeployment="${DEPLOY_UP_TO_DATE_APP:-}"
+
+echo "${1}" >> "${binary}-commands"
 
 if [ "${binary}" = "clever" ] && [ "${1}" = "--version" ]; then
     echo "2.6.1"
@@ -10,10 +13,17 @@ elif [ "${binary}" = "clever" ] && [ "${1}" = "activity" ]; then
     echo "2020-02-02T20:20:02+02:00  OK         DEPLOY     ${remoteCommit}  Git"
 elif [ "${binary}" = "clever" ] && [ "${1}" = "status" ]; then
     echo "test-app: running (1*pico,  Commit: ${remoteCommit})"
+elif [ "${binary}" = "clever" ] && [ "${1}" = "deploy" ]; then
+    if [ -z "${uptodateDeployment}" ]; then
+        echo "Clever deploy done."
+    else
+        # Mimic the current behavior until https://github.com/CleverCloud/clever-tools/issues/422 is solved
+        >&2 echo "The clever-cloud application is up-to-date. Try this command to restart the application:"
+        >&2 echo "        clever restart"
+        exit 1
+    fi
 elif [ "${binary}" = "git" ]; then
     echo "${localCommit}"
 else
     echo "${binary} called with arguments: ${*}"
 fi
-
-echo "${1}" >> "${binary}-commands"