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.
This commit is contained in:
Claudiu Belu 2020-11-11 13:07:31 +00:00
parent cdec7e8b1f
commit ef530c12d6
2 changed files with 4 additions and 3 deletions

View File

@ -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 \

View File

@ -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"