From ef530c12d6cfd150406c36a16ff51d90a386db66 Mon Sep 17 00:00:00 2001 From: Claudiu Belu Date: Wed, 11 Nov 2020 13:07:31 +0000 Subject: [PATCH] test images: Adds -p yes when calling register.sh Before creating and bootstrapping a docker buildx instance, we need to call register.sh with the -p yes flag. Without this, the docker buildx will only support linux/amd64 and linux/386 platforms, meaning that it will fail when trying to build images for other architecture types. Additionally, the builder has to have qemu and its qemu-* binaries installed in order to properly build the images. The recently created image gcr.io/k8s-testimages/gcb-docker-gcloud:v20201130-750d12f has those requirements met. --- test/images/cloudbuild.yaml | 5 +++-- test/images/image-util.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/images/cloudbuild.yaml b/test/images/cloudbuild.yaml index 552aa732395..1fccdc64afe 100644 --- a/test/images/cloudbuild.yaml +++ b/test/images/cloudbuild.yaml @@ -9,7 +9,7 @@ options: substitution_option: ALLOW_LOOSE machineType: 'N1_HIGHCPU_8' steps: - - name: 'gcr.io/k8s-testimages/gcb-docker-gcloud:v20200422-b25d964' + - name: 'gcr.io/k8s-testimages/gcb-docker-gcloud:v20201130-750d12f' entrypoint: 'bash' dir: ./test/images/ env: @@ -21,11 +21,12 @@ steps: # The default cloudbuild has HOME=/builder/home and docker buildx is in /root/.docker/cli-plugins/docker-buildx # We need to set the HOME to /root explicitly since we're using docker buildx - HOME=/root + # NOTE(claudiub): we need to call register.sh before creating and bootstraping a docker buildx instance. args: - '-c' - | gcloud auth configure-docker \ - && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes \ + && ../../third_party/multiarch/qemu-user-static/register/register.sh --reset -p yes \ && export DOCKER_CLI_EXPERIMENTAL=enabled \ && docker buildx create --name img-builder --use \ && docker buildx inspect --bootstrap \ diff --git a/test/images/image-util.sh b/test/images/image-util.sh index e479952c00c..25a18488f84 100755 --- a/test/images/image-util.sh +++ b/test/images/image-util.sh @@ -149,7 +149,7 @@ build() { if [[ $(id -u) != 0 ]]; then sudo=sudo fi - ${sudo} "${KUBE_ROOT}/third_party/multiarch/qemu-user-static/register/register.sh" --reset + ${sudo} "${KUBE_ROOT}/third_party/multiarch/qemu-user-static/register/register.sh" --reset -p yes curl -sSL https://github.com/multiarch/qemu-user-static/releases/download/"${QEMUVERSION}"/x86_64_qemu-"${QEMUARCHS[$arch]}"-static.tar.gz | tar -xz -C "${temp_dir}" # Ensure we don't get surprised by umask settings chmod 0755 "${temp_dir}/qemu-${QEMUARCHS[$arch]}-static"