aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2019-06-10 21:22:01 -0300
committerEuAndreh <eu@euandre.org>2019-06-10 21:22:01 -0300
commit66c3cb1b2b9739b0e3bf12ab8b079a8aa4736d4b (patch)
tree373a6c9a3d2c8bb112ecdde4505f5e9e865100e6
parentOnly send log email when running on CI (diff)
downloadserver-66c3cb1b2b9739b0e3bf12ab8b079a8aa4736d4b.tar.gz
server-66c3cb1b2b9739b0e3bf12ab8b079a8aa4736d4b.tar.xz
Store updated Terraform files in case of failure
-rw-r--r--TODOs.org3
-rwxr-xr-xscripts/ci/provision.sh8
2 files changed, 10 insertions, 1 deletions
diff --git a/TODOs.org b/TODOs.org
index 058a353..471f59c 100644
--- a/TODOs.org
+++ b/TODOs.org
@@ -143,7 +143,8 @@ Right now, secrets are scattered between the two repositories. By moving I can c
** TODO Run backup on Terraform destroy action instead of manually in =provision.sh=
** DONE Explicitly destroy Droplets before running Terraform apply
CLOSED: [2019-06-05 Wed 19:48]
-** NEXT Store updated =.tfstate= even in case of deployment failure
+** DONE Store updated =.tfstate= even in case of deployment failure
+CLOSED: [2019-06-10 Mon 21:21]
Right now the script fails on Terraform commands before reaching git commands. I should trap the error, store on git and only then fail.
** DONE Fix alias in =bash-profile.sh=
CLOSED: [2019-06-10 Mon 09:01]
diff --git a/scripts/ci/provision.sh b/scripts/ci/provision.sh
index 74f56f2..d96d854 100755
--- a/scripts/ci/provision.sh
+++ b/scripts/ci/provision.sh
@@ -14,6 +14,14 @@ mail_debug_log() {
echo "Sending logs via email..."
./scripts/ci/mail.sh "${VPS_COMMIT_SHA}" "${ec}"
echo "Done."
+
+ echo "Storing file changes to '.tfstate' files..."
+ pushd ../vps-state/
+ git add .
+ git commit -m "CI: fallback add all after provision.sh failure for CI run $VPS_COMMIT_SHA" ||:
+ git push origin master
+ popd
+ echo "Done."
}
trap mail_debug_log EXIT