Image Promoter: Cleans manifest list

The manifest list is stateful, which means that the same list will get amended
with each successive image published. That's unintended, and can lead to the
wrong image being pulled from the manifest list.

Resets the manifest list before amending new images into it.
This commit is contained in:
Claudiu Belu 2020-01-10 00:30:06 -08:00
parent 52d7614a8c
commit 26ea420c0e

View File

@ -133,6 +133,8 @@ push() {
# The manifest command is still experimental as of Docker 18.09.2
export DOCKER_CLI_EXPERIMENTAL="enabled"
# reset manifest list; needed in case multiple images are being built / pushed.
manifest=()
# Make archs list into image manifest. Eg: 'amd64 ppc64le' to '${REGISTRY}/${image}-amd64:${TAG} ${REGISTRY}/${image}-ppc64le:${TAG}'
while IFS='' read -r line; do manifest+=("$line"); done < <(echo "$archs" | ${SED} -e "s~[^ ]*~$REGISTRY\/$image\-&:$TAG~g")
docker manifest create --amend "${REGISTRY}/${image}:${TAG}" "${manifest[@]}"