mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
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:
parent
09f4baed35
commit
ab3bd32d22
@ -96,7 +96,7 @@ build() {
|
|||||||
os_archs=$(listOsArchs "$image")
|
os_archs=$(listOsArchs "$image")
|
||||||
else
|
else
|
||||||
# prepend linux/ to the QEMUARCHS items.
|
# prepend linux/ to the QEMUARCHS items.
|
||||||
os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[*]}")
|
os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[@]}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kube::util::ensure-gnu-sed
|
kube::util::ensure-gnu-sed
|
||||||
@ -126,17 +126,17 @@ build() {
|
|||||||
# image tag
|
# image tag
|
||||||
TAG=$(<VERSION)
|
TAG=$(<VERSION)
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
dockerfile_name="Dockerfile"
|
||||||
|
if [[ "$os_name" = "windows" && -f "Dockerfile_windows" ]]; then
|
||||||
|
dockerfile_name="Dockerfile_windows"
|
||||||
|
fi
|
||||||
|
|
||||||
|
base_image=""
|
||||||
if [[ -f BASEIMAGE ]]; then
|
if [[ -f BASEIMAGE ]]; then
|
||||||
BASEIMAGE=$(getBaseImage "${os_arch}" | ${SED} "s|REGISTRY|${REGISTRY}|g")
|
base_image=$(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.
|
|
||||||
dockerfile_name="Dockerfile"
|
|
||||||
if [[ "$os_name" = "windows" && -f "Dockerfile_windows" ]]; then
|
|
||||||
dockerfile_name="Dockerfile_windows"
|
|
||||||
fi
|
|
||||||
|
|
||||||
${SED} -i "s|BASEARCH|${arch}|g" $dockerfile_name
|
${SED} -i "s|BASEARCH|${arch}|g" $dockerfile_name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ build() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
docker buildx build --no-cache --pull --output=type="${output_type}" --platform "${os_name}/${arch}" \
|
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}" .
|
-t "${REGISTRY}/${image}:${TAG}-${suffix}" -f "${dockerfile_name}" .
|
||||||
|
|
||||||
popd
|
popd
|
||||||
@ -187,7 +187,7 @@ push() {
|
|||||||
os_archs=$(listOsArchs "$image")
|
os_archs=$(listOsArchs "$image")
|
||||||
else
|
else
|
||||||
# prepend linux/ to the QEMUARCHS items.
|
# prepend linux/ to the QEMUARCHS items.
|
||||||
os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[*]}")
|
os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[@]}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kube::util::ensure-gnu-sed
|
kube::util::ensure-gnu-sed
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright 2016 The Kubernetes Authors.
|
# Copyright 2021 The Kubernetes Authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
Loading…
Reference in New Issue
Block a user