]> git.immae.eu Git - github/fretlink/ansible-clever.git/commitdiff
Make commit ids overridable in the script mock
authorClement Delafargue <clement.delafargue@fretlink.com>
Tue, 30 Jun 2020 07:30:04 +0000 (09:30 +0200)
committerClement Delafargue <clement.delafargue@fretlink.com>
Tue, 30 Jun 2020 13:31:57 +0000 (15:31 +0200)
tests/fake.sh

index bbb4380637bf691669764043ccd1856cc9ec4c6e..0303b61cbeff465187a066b689d78affee67f4f4 100755 (executable)
@@ -1,14 +1,17 @@
 #!/usr/bin/env bash
 
 binary="${0/*\/}"
-fakeCommit="aaa000aaa000aaa000aaa000aaa000aaa000aaa0"
+localCommit="${PRETEND_LOCAL_COMMIT:-aaa000aaa000aaa000aaa000aaa000aaa000aaa0}"
+remoteCommit="${PRETEND_REMOTE_COMMIT:-bbb000bbb000bbb000bbb000bbb000bbb000bbb0}"
 
 if [ "${binary}" = "clever" ] && [ "${1}" = "--version" ]; then
     echo "2.6.1"
 elif [ "${binary}" = "clever" ] && [ "${1}" = "activity" ]; then
-    echo "2020-02-02T20:20:02+02:00  OK         DEPLOY     ${fakeCommit}  Git"
+    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}" = "git" ]; then
-    echo "${fakeCommit}"
+    echo "${localCommit}"
 else
     echo "${1}" >> "${binary}-commands"
     echo "${binary} called with arguments: ${*}"