From 35adfde176a1af7e030196c847f567162a0be522 Mon Sep 17 00:00:00 2001 From: Lizan Zhou Date: Tue, 18 Aug 2020 21:23:46 +0000 Subject: [PATCH 1/2] ci: fix VRP image push Signed-off-by: Lizan Zhou --- ci/docker_ci.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ci/docker_ci.sh b/ci/docker_ci.sh index 233be1db9187..3dfb9eb04c05 100755 --- a/ci/docker_ci.sh +++ b/ci/docker_ci.sh @@ -46,7 +46,6 @@ IMAGES_TO_SAVE=() build_images() { TYPE=$1 BUILD_TAG=$2 - BASE=$3 use_builder "${TYPE}" ARGS="$(build_args ${TYPE})" @@ -57,7 +56,11 @@ build_images() { PLATFORM="$(build_platforms ${TYPE} | tr ',' ' ')" # docker buildx load cannot have multiple platform, load individually for ARCH in ${PLATFORM}; do - IMAGE_TAG="${BUILD_TAG}-${ARCH/linux\//}" + if [[ "${ARCH}" == "linux/amd64" ]]; then + IMAGE_TAG="${BUILD_TAG}" + else + IMAGE_TAG="${BUILD_TAG}-${ARCH/linux\//}" + fi docker buildx build --platform "${ARCH}" -f ci/Dockerfile-envoy"${TYPE}" ${ARGS} -t "${IMAGE_TAG}" . --load IMAGES_TO_SAVE+=("${IMAGE_TAG}") done @@ -66,12 +69,13 @@ build_images() { push_images() { TYPE=$1 BUILD_TAG=$2 - BASE=$3 use_builder "${TYPE}" ARGS="$(build_args ${TYPE})" PLATFORM="$(build_platforms ${TYPE})" - docker buildx build --platform "${PLATFORM}" -f ci/Dockerfile-envoy"${TYPE}" ${ARGS} -t ${BUILD_TAG} . --push + # docker buildx doesn't do push with default builder + docker buildx build --platform "${PLATFORM}" -f ci/Dockerfile-envoy"${TYPE}" ${ARGS} -t ${BUILD_TAG} . --push || \ + docker push "${BUILD_TAG}" } MASTER_BRANCH="refs/heads/master" @@ -122,11 +126,11 @@ fi docker login -u "$DOCKERHUB_USERNAME" -p "$DOCKERHUB_PASSWORD" for BUILD_TYPE in "${BUILD_TYPES[@]}"; do - push_images "${BUILD_TYPE}" "${DOCKER_IMAGE_PREFIX}${BUILD_TYPE}${IMAGE_POSTFIX}:${IMAGE_NAME}" "${BASE_IMAGE}" + push_images "${BUILD_TYPE}" "${DOCKER_IMAGE_PREFIX}${BUILD_TYPE}${IMAGE_POSTFIX}:${IMAGE_NAME}" # Only push latest on master builds. if [[ "${AZP_BRANCH}" == "${MASTER_BRANCH}" ]]; then - push_images "${BUILD_TYPE}" "${DOCKER_IMAGE_PREFIX}${BUILD_TYPE}${IMAGE_POSTFIX}:latest" "${BASE_IMAGE}" + push_images "${BUILD_TYPE}" "${DOCKER_IMAGE_PREFIX}${BUILD_TYPE}${IMAGE_POSTFIX}:latest" fi # Push vX.Y-latest to tag the latest image in a release line From 1249f65729e2d07e68185ccbb8bb4991d7944170 Mon Sep 17 00:00:00 2001 From: Lizan Zhou Date: Tue, 18 Aug 2020 23:18:00 +0000 Subject: [PATCH 2/2] base image no longer have -amd64 suffix Signed-off-by: Lizan Zhou --- ci/docker_ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/docker_ci.sh b/ci/docker_ci.sh index 3dfb9eb04c05..ae8d83f0777d 100755 --- a/ci/docker_ci.sh +++ b/ci/docker_ci.sh @@ -102,7 +102,7 @@ BUILD_TYPES=("" "-alpine" "-alpine-debug" "-google-vrp") config_env # VRP base image is only for amd64 -VRP_BASE_IMAGE="${DOCKER_IMAGE_PREFIX}${IMAGE_POSTFIX}:${IMAGE_NAME}-amd64" +VRP_BASE_IMAGE="${DOCKER_IMAGE_PREFIX}${IMAGE_POSTFIX}:${IMAGE_NAME}" # Test the docker build in all cases, but use a local tag that we will overwrite before push in the # cases where we do push.