diff options
author | EuAndreh <eu@euandre.org> | 2019-06-10 21:22:01 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2019-06-10 21:22:01 -0300 |
commit | 66c3cb1b2b9739b0e3bf12ab8b079a8aa4736d4b (patch) | |
tree | 373a6c9a3d2c8bb112ecdde4505f5e9e865100e6 | |
parent | Only send log email when running on CI (diff) | |
download | server-66c3cb1b2b9739b0e3bf12ab8b079a8aa4736d4b.tar.gz server-66c3cb1b2b9739b0e3bf12ab8b079a8aa4736d4b.tar.xz |
Store updated Terraform files in case of failure
-rw-r--r-- | TODOs.org | 3 | ||||
-rwxr-xr-x | scripts/ci/provision.sh | 8 |
2 files changed, 10 insertions, 1 deletions
@@ -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 |