ci: trigger image promotion for deployment

Once an image is built and ready, exec the binary defined in the env var
IMAGE_PROMOTION_COMMAND to promote it (if set).
pull/24376/head
Dom 2021-01-19 14:57:42 +00:00
parent 7cb512ef67
commit 348aaab6dd
1 changed files with 12 additions and 2 deletions

View File

@ -13,7 +13,9 @@
# And the image is on the host, executing this script with:
# ./get-deploy-tags "awesome"
#
# Will generate the deployment JSON file.
# Will generate the deployment JSON file and output it to stdout. If
# IMAGE_PROMOTION_COMMAND is set in the environment, the deployment JSON file is
# piped to it at the end of execution.
set -euo pipefail
@ -45,4 +47,12 @@ jq --null-input --sort-keys \
},
},
PublishedAt: (now | todateiso8601)
}'
}' | tee deploy.json
echo ""
if [[ -z "${IMAGE_PROMOTION_COMMAND}" ]]; then
echo "Skipping image promotion (IMAGE_PROMOTION_COMMAND not set)"
else
echo "Triggering image promotion"
eval "${IMAGE_PROMOTION_COMMAND}" < deploy.json
fi