set -e
if [[ $(which ytt) == "" ]]; then
echo "You will need to install ytt to repipe. https://carvel.dev/ytt/"
exit 1
fi
target="${FLY_TARGET:-cepler}"
REPO_ROOT_DIR="$(dirname $( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd ))"
TMPDIR=""¬
TMPDIR=$(mktemp -d -t repipe.XXXXXX)
trap "rm -rf ${TMPDIR}" INT TERM QUIT EXIT
ytt -f ci > ${TMPDIR}/pipeline.yml
echo "Updating pipeline @ ${target}"
fly -t ${target} set-pipeline -p cepler -c ${TMPDIR}/pipeline.yml
fly -t ${target} unpause-pipeline -p cepler