From fdda5cd0e3ccf1b3a72f949911ce826246a111de Mon Sep 17 00:00:00 2001 From: mrekucci Date: Fri, 5 Jul 2024 16:17:31 +0200 Subject: [PATCH] refactor: fail fast on build artifacts error --- infrastructure/nomad/playbooks/deploy.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/infrastructure/nomad/playbooks/deploy.yml b/infrastructure/nomad/playbooks/deploy.yml index 2af5605e3..2dfaa92db 100644 --- a/infrastructure/nomad/playbooks/deploy.yml +++ b/infrastructure/nomad/playbooks/deploy.yml @@ -221,6 +221,7 @@ fi set +x goreleaser release --snapshot --config=./{{ artifact.path }}/.goreleaser.tmp.yml + if [ $? -ne 0 ]; then exit 1; fi rm ./{{ artifact.path }}/.goreleaser.tmp.yml fi flock -v -u 192 @@ -231,6 +232,7 @@ echo "${ARTIFACT}" >> "${INVENTORY}" flock -v -u 192 tar -czvf "${ARTIFACT}" ./{{ artifact.path }} + if [ $? -ne 0 ]; then exit 1; fi fi {% endif %} @@ -245,6 +247,7 @@ --passphrase="${PASSPHRASE}" \ --log-fmt="json" ) + if [ $? -ne 0 ]; then exit 1; fi ARTIFACT_PATH="$(echo ${RESULT} | jq -e -r '.path // empty' 2>/dev/null)" flock -v -x 192 echo "${ARTIFACT_PATH}" >> "${INVENTORY}" @@ -261,6 +264,7 @@ "{{ artifact.keystore.name }}_password": $keystore_password }' \ > "${SECRETS}" + if [ $? -ne 0 ]; then exit 1; fi flock -v -u 191 ADDRESS="$(cat ${ARTIFACT_PATH} | jq -r '.address')" @@ -309,6 +313,7 @@ "{{ artifact.keystore.name }}_password": $keystore_password }' \ > "${SECRETS}" + if [ $? -ne 0 ]; then exit 1; fi flock -v -u 191 ADDRESS=$(echo "${KEYSTORE}" | jq -r '.address') @@ -331,6 +336,7 @@ {% endif %} {% if artifact.boot_key | default(false) and environments[env].secrets == 'generate' %} bootnode -genkey "${DESTINATION_DIR}/boot.key" + if [ $? -ne 0 ]; then exit 1; fi flock -v -x 191 cat "${SECRETS}" | jq \ @@ -342,6 +348,7 @@ ($item_name + "_boot_key_address"): $boot_key_address }' \ > "${SECRETS}" + if [ $? -ne 0 ]; then exit 1; fi flock -v -u 191 {% endif %}