Fix image publishing in post pipeline

docker push --all-tags requires image repository without tag.

Change-Id: I68a4a128bb11e4edbe3e4864ffb372d7e9ce4698
Signed-off-by: Andrii Ostapenko <anost1986@gmail.com>
This commit is contained in:
Andrii Ostapenko 2021-11-19 20:51:47 -07:00
parent 1767e4dac4
commit 6c91d54e96
No known key found for this signature in database
GPG Key ID: F3E83668DBB223B3

View File

@ -77,7 +77,8 @@ endif
export DOCKERFILE=Dockerfile.$(DISTRO) export DOCKERFILE=Dockerfile.$(DISTRO)
export DOCKERFILE_FOLDER="." export DOCKERFILE_FOLDER="."
export IMAGE_NAME=image-builder export IMAGE_NAME=image-builder
export SOURCE_IMAGE_TAG=${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO} export SOURCE_IMAGE_REPO="${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}"
export SOURCE_IMAGE_TAG=$${SOURCE_IMAGE_REPO}:${IMAGE_TAG}-${DISTRO}
ifneq (,$(findstring latest, $(IMAGE_TAG))) ifneq (,$(findstring latest, $(IMAGE_TAG)))
ifneq ($(PROXY), ) ifneq ($(PROXY), )
sudo -E ./tools/docker_proxy.sh $(PROXY) $(NO_PROXY) sudo -E ./tools/docker_proxy.sh $(PROXY) $(NO_PROXY)
@ -106,8 +107,9 @@ endif
sudo cat /tmp/sticky_result && exit 1) sudo cat /tmp/sticky_result && exit 1)
else else
# Set SOURCE_IMAGE_TAG and TARGET_IMAGE_TAG for tagging purposes # Set SOURCE_IMAGE_TAG and TARGET_IMAGE_TAG for tagging purposes
export SOURCE_IMAGE_TAG="${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG_FIRST}-${DISTRO}" export SOURCE_IMAGE_REPO="${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}"
export TARGET_IMAGE_TAG="${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO}" export SOURCE_IMAGE_TAG="$${SOURCE_IMAGE_REPO}:${IMAGE_TAG_FIRST}-${DISTRO}"
export TARGET_IMAGE_TAG="$${SOURCE_IMAGE_REPO}:${IMAGE_TAG}-${DISTRO}"
# Don't repackage image-builder, just tag it. # Don't repackage image-builder, just tag it.
sudo -E make tag sudo -E make tag
endif endif
@ -181,12 +183,14 @@ ifneq (,$(findstring latest, $(IMAGE_TAG)))
export DOCKERFILE="Dockerfile-qcow.$(DISTRO)" export DOCKERFILE="Dockerfile-qcow.$(DISTRO)"
export DOCKERFILE_FOLDER="$(WORKDIR)/$$bundledir" export DOCKERFILE_FOLDER="$(WORKDIR)/$$bundledir"
export IMAGE_NAME=$$bundledir export IMAGE_NAME=$$bundledir
export SOURCE_IMAGE_TAG=${DOCKER_REGISTRY}/${IMAGE_PREFIX}/$$bundledir:${IMAGE_TAG}-${DISTRO} export SOURCE_IMAGE_REPO="${DOCKER_REGISTRY}/${IMAGE_PREFIX}/$$bundledir"
export SOURCE_IMAGE_TAG="$${SOURCE_IMAGE_REPO}:${IMAGE_TAG}-${DISTRO}"
sudo -E make docker_build sudo -E make docker_build
else else
# Set SOURCE_IMAGE_TAG & TARGET_IMAGE_TAG for tagging purposes # Set SOURCE_IMAGE_TAG & TARGET_IMAGE_TAG for tagging purposes
export SOURCE_IMAGE_TAG=${DOCKER_REGISTRY}/${IMAGE_PREFIX}/$$bundledir:${IMAGE_TAG_FIRST}-${DISTRO} export SOURCE_IMAGE_REPO="${DOCKER_REGISTRY}/${IMAGE_PREFIX}/$$bundledir"
export TARGET_IMAGE_TAG="${DOCKER_REGISTRY}/${IMAGE_PREFIX}/$$bundledir:${IMAGE_TAG}-${DISTRO}" export SOURCE_IMAGE_TAG="$${SOURCE_IMAGE_REPO}:${IMAGE_TAG_FIRST}-${DISTRO}"
export TARGET_IMAGE_TAG="$${SOURCE_IMAGE_REPO}:${IMAGE_TAG}-${DISTRO}"
# Don't repackage qcow, just tag it. # Don't repackage qcow, just tag it.
sudo -E make tag sudo -E make tag
endif endif
@ -238,7 +242,7 @@ tag:
push: push:
set -ex set -ex
sudo -E DOCKER_BUILDKIT=1 docker image push --all-tags $(SOURCE_IMAGE_TAG) sudo -E DOCKER_BUILDKIT=1 docker image push --all-tags $(SOURCE_IMAGE_REPO)
tests: tests:
true true