aboutsummaryrefslogtreecommitdiffhomepage
path: root/files
diff options
context:
space:
mode:
authorClement Delafargue <clement.delafargue@fretlink.com>2020-06-24 11:34:28 +0200
committerClement Delafargue <clement.delafargue@fretlink.com>2020-06-30 15:31:19 +0200
commitfacc275a703d3bccc320e5577eb3d050f99dff0e (patch)
tree0f7aaa15f07c446b00484fa54bd98d2bb5c648c2 /files
parent44e55b1d81f5defe28249d6b70b894c1ebad7c91 (diff)
downloadansible-clever-facc275a703d3bccc320e5577eb3d050f99dff0e.tar.gz
ansible-clever-facc275a703d3bccc320e5577eb3d050f99dff0e.tar.zst
ansible-clever-facc275a703d3bccc320e5577eb3d050f99dff0e.zip
Don't run `clever deploy` if the app is up-to-date
Running `git push` when the remote is up-to-date no-ops (it does not trigger a deployment, but it does not fail either). Running `clever deploy` when the remote is up-to-date triggers a failure. Here, we care about the _end result_ (ie the app is deployed on the correct commit), so no-oping is more appropriate. This behaviour is not baked in `clever-tools`, but I think it should. I opened an issue. This script is a temporary workaround. (at least I hope it's temporary) https://github.com/CleverCloud/clever-tools/issues/422
Diffstat (limited to 'files')
-rwxr-xr-xfiles/clever-deploy.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/files/clever-deploy.sh b/files/clever-deploy.sh
new file mode 100755
index 0000000..c301a89
--- /dev/null
+++ b/files/clever-deploy.sh
@@ -0,0 +1,15 @@
1#!/usr/bin/env bash
2
3function getHeadRev {
4 git rev-parse HEAD
5}
6
7target_commit="$(getHeadRev)"
8running_commit=$(clever status | grep running | sed 's/^.*Commit: //' | sed 's/)$//')
9
10if [ "${running_commit}" != "${target_commit}" ]; then
11 echo "Deploying commit ${target_commit}"
12 clever deploy --force
13else
14 echo "${target_commit} is already deployed, nothing to do"
15fi