Skip to content
Merged
13 changes: 9 additions & 4 deletions .codebuild/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ deploy_hathor_network_account() {
send_slack_message "New version deployed to mainnet-staging: ${GIT_REF_TO_DEPLOY}"
elif expr "${GIT_REF_TO_DEPLOY}" : "v.*" >/dev/null; then
echo $GIT_REF_TO_DEPLOY > /tmp/docker_image_tag
make build-daemon;

# --- Testnet ---
# Gets all env vars with `testnet_` prefix and re-exports them without the prefix
Expand All @@ -75,29 +74,35 @@ deploy_hathor_network_account() {
done

make migrate;
make build-daemon;
make deploy-lambdas-testnet;
# The idea here is that if the lambdas deploy fail, the built image won't be pushed:
make push-daemon;

# Unsets all the testnet env vars so we make sure they don't leak to other deploys
for var in "${!testnet_@}"; do
unset ${var#testnet_}
done

send_slack_message "New version deployed to testnet-production: ${GIT_REF_TO_DEPLOY}"

# --- Mainnet ---
# Gets all env vars with `mainnet_` prefix and re-exports them without the prefix
for var in "${!mainnet_@}"; do
export ${var#mainnet_}="${!var}"
done
make migrate;
make build-daemon;
make deploy-lambdas-mainnet;
# The idea here is that if the lambdas deploy fail, the built image won't be pushed:
make push-daemon;

# Unsets all the mainnet env vars so we make sure they don't leak to other deploys
for var in "${!mainnet_@}"; do
unset ${var#mainnet_}
done

# The idea here is that if the lambdas deploy fail, the built image won't be pushed:
make push-daemon;
send_slack_message "New version deployed to testnet-production and mainnet-production: ${GIT_REF_TO_DEPLOY}"
send_slack_message "New version deployed to mainnet-production: ${GIT_REF_TO_DEPLOY}"
else
# Gets all env vars with `dev_` prefix and re-exports them without the prefix
for var in "${!dev_@}"; do
Expand Down
5 changes: 5 additions & 0 deletions scripts/push-daemon.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
set -e
set -o pipefail

if [ -z "$ACCOUNT_ID" ]; then
echo "Please export a ACCOUNT_ID env var before running this";
exit 1;
fi

DOCKER_IMAGE_TAG=$(cat /tmp/docker_image_tag)

if [ -z "$DOCKER_IMAGE_TAG" ]; then
Expand Down