diff --git a/test/images/Makefile b/test/images/Makefile index eab02cc3a9..81be891ce4 100644 --- a/test/images/Makefile +++ b/test/images/Makefile @@ -36,7 +36,7 @@ all: all-container all-container: ./image-util.sh build $(WHAT) -all-push: all-container manifest-tool +all-push: all-container ./image-util.sh push $(WHAT) .PHONY: all all-push all-container diff --git a/test/images/image-util.sh b/test/images/image-util.sh index c933d2c8f9..238bade438 100755 --- a/test/images/image-util.sh +++ b/test/images/image-util.sh @@ -90,19 +90,23 @@ build() { # This function will push the docker images push() { + TAG=$(<${IMAGE}/VERSION) if [[ -f ${IMAGE}/BASEIMAGE ]]; then archs=$(listArchs) else archs=${!QEMUARCHS[@]} fi for arch in ${archs}; do - TAG=$(<${IMAGE}/VERSION) docker push ${REGISTRY}/${IMAGE}-${arch}:${TAG} done - # Make archs list into OS/architecture pair. Eg: 'amd64 ppc64le' to 'linux/amd64,linux/ppc64le' - archs=$(echo $archs | sed -e 's/[^ ]* */linux\/&/g' -e 's/ /,/g') - manifest-tool push from-args --platforms ${archs} --template ${REGISTRY}/${IMAGE}-ARCH:${TAG} --target ${REGISTRY}/${IMAGE}:${TAG} + # Make archs list into image manifest. Eg: 'amd64 ppc64le' to '${REGISTRY}/${IMAGE}-amd64:${TAG} ${REGISTRY}/${IMAGE}-ppc64le:${TAG}' + manifest=$(echo $archs | sed -e "s~[^ ]*~$REGISTRY\/$IMAGE\-&:$TAG~g") + docker manifest create --amend ${REGISTRY}/${IMAGE}:${TAG} ${manifest} + for arch in ${archs}; do + docker manifest annotate --arch ${arch} ${REGISTRY}/${IMAGE}:${TAG} ${REGISTRY}/${IMAGE}-${arch}:${TAG} + done + docker manifest push ${REGISTRY}/${IMAGE}:${TAG} } # This function is for building the go code