test images: Fixes metadata-concealment image building

The metadata-concealment image does not have any BASEIMAGE file, which means
that the image will be built from scratch. In this case, there are a few
fixes that need to be made in the image-build.sh script.
This commit is contained in:
Claudiu Belu 2021-01-20 13:35:01 +00:00
parent 09f4baed35
commit ab3bd32d22
2 changed files with 14 additions and 14 deletions

View File

@ -96,7 +96,7 @@ build() {
os_archs=$(listOsArchs "$image")
else
# prepend linux/ to the QEMUARCHS items.
os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[*]}")
os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[@]}")
fi
kube::util::ensure-gnu-sed
@ -126,9 +126,6 @@ build() {
# image tag
TAG=$(<VERSION)
if [[ -f BASEIMAGE ]]; then
BASEIMAGE=$(getBaseImage "${os_arch}" | ${SED} "s|REGISTRY|${REGISTRY}|g")
# NOTE(claudiub): Some Windows images might require their own Dockerfile
# while simpler ones will not. If we're building for Windows, check if
# "Dockerfile_windows" exists or not.
@ -137,6 +134,9 @@ build() {
dockerfile_name="Dockerfile_windows"
fi
base_image=""
if [[ -f BASEIMAGE ]]; then
base_image=$(getBaseImage "${os_arch}" | ${SED} "s|REGISTRY|${REGISTRY}|g")
${SED} -i "s|BASEARCH|${arch}|g" $dockerfile_name
fi
@ -161,7 +161,7 @@ build() {
fi
docker buildx build --no-cache --pull --output=type="${output_type}" --platform "${os_name}/${arch}" \
--build-arg BASEIMAGE="${BASEIMAGE}" --build-arg REGISTRY="${REGISTRY}" --build-arg OS_VERSION="${os_version}" \
--build-arg BASEIMAGE="${base_image}" --build-arg REGISTRY="${REGISTRY}" --build-arg OS_VERSION="${os_version}" \
-t "${REGISTRY}/${image}:${TAG}-${suffix}" -f "${dockerfile_name}" .
popd
@ -187,7 +187,7 @@ push() {
os_archs=$(listOsArchs "$image")
else
# prepend linux/ to the QEMUARCHS items.
os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[*]}")
os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[@]}")
fi
kube::util::ensure-gnu-sed

View File

@ -1,4 +1,4 @@
# Copyright 2016 The Kubernetes Authors.
# Copyright 2021 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.