#!/bin/bash
#
# Required variables are:
# - DEPLOY_ENV
# - AWS_ACCOUNT
# - SELF_UPDATE_PIPELINE
#
# Optional variables:
# - BRANCH
# - PIPELINES_TO_UPDATE

set -u
set -e

if [ ! -d "./paas-cf" ]; then
  echo "Resource paas-cf must be checkout"
  exit 1
fi

if [ "${SELF_UPDATE_PIPELINE}" != "true" ]; then
  echo "Self update pipeline is disabled. Skipping. (set SELF_UPDATE_PIPELINE=true to enable)"
else
  echo "Self update pipeline is enabled. Updating. (set SELF_UPDATE_PIPELINE=false to disable)"

  make -C ./paas-cf "${AWS_ACCOUNT}" pipelines
fi

#!/bin/bash
#
# Required variables are:
# - DEPLOY_ENV
# - AWS_ACCOUNT
# - SELF_UPDATE_PIPELINE
#
# Optional variables:
# - BRANCH
# - PIPELINES_TO_UPDATE

# FIXME: Remove after switched to AWS_ACCOUNT
AWS_ACCOUNT=${AWS_ACCOUNT:-$MAKEFILE_ENV_TARGET}

set -u
set -e

if [ ! -d "./paas-cf" ]; then
  echo "Resource paas-cf must be checkout"
  exit 1
fi

if [ "${SELF_UPDATE_PIPELINE}" != "true" ]; then
  echo "Self update pipeline is disabled. Skipping. (set SELF_UPDATE_PIPELINE=true to enable)"
else
  echo "Self update pipeline is enabled. Updating. (set SELF_UPDATE_PIPELINE=false to disable)"

  make -C ./paas-cf "${AWS_ACCOUNT}" pipelines
fi

Fix self-update pipelines MAKEFILE_ENV_TARGET removal
Fix self-update pipelines MAKEFILE_ENV_TARGET removal

We removed MAKEFILE_ENV_TARGET and replaced it with AWS_ACCOUNT, but that
one is only available _after_ successfull self update. Fix the script to
take the old variable still.
