Merge pull request #95567 from claudiubelu/test-images/linux-busybox
test images: Mirrors dockerhub images to staging
This commit is contained in:
@@ -89,16 +89,26 @@ getBaseImage() {
|
||||
# arm64, ppc64le, s390x
|
||||
build() {
|
||||
image=$1
|
||||
img_folder=$1
|
||||
output_type=$2
|
||||
docker_version_check
|
||||
|
||||
if [[ -f ${image}/BASEIMAGE ]]; then
|
||||
if [[ -f "${img_folder}/BASEIMAGE" ]]; then
|
||||
os_archs=$(listOsArchs "$image")
|
||||
else
|
||||
# prepend linux/ to the QEMUARCHS items.
|
||||
os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[@]}")
|
||||
fi
|
||||
|
||||
# image tag
|
||||
TAG=$(<"${img_folder}/VERSION")
|
||||
|
||||
alias_name="$(cat "${img_folder}/ALIAS" 2>/dev/null || true)"
|
||||
if [[ -n "${alias_name}" ]]; then
|
||||
echo "Found an alias for '${image}'. Building / tagging image as '${alias_name}.'"
|
||||
image="${alias_name}"
|
||||
fi
|
||||
|
||||
kube::util::ensure-gnu-sed
|
||||
|
||||
for os_arch in ${os_archs}; do
|
||||
@@ -116,15 +126,13 @@ build() {
|
||||
temp_dir=$(mktemp -d "${KUBE_ROOT}"/_tmp/test-images-build.XXXXXX)
|
||||
kube::util::trap_add "rm -rf ${temp_dir}" EXIT
|
||||
|
||||
cp -r "${image}"/* "${temp_dir}"
|
||||
if [[ -f ${image}/Makefile ]]; then
|
||||
cp -r "${img_folder}"/* "${temp_dir}"
|
||||
if [[ -f ${img_folder}/Makefile ]]; then
|
||||
# make bin will take care of all the prerequisites needed
|
||||
# for building the docker image
|
||||
make -C "${image}" bin OS="${os_name}" ARCH="${arch}" TARGET="${temp_dir}"
|
||||
make -C "${img_folder}" bin OS="${os_name}" ARCH="${arch}" TARGET="${temp_dir}"
|
||||
fi
|
||||
pushd "${temp_dir}"
|
||||
# image tag
|
||||
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
|
||||
@@ -190,6 +198,13 @@ push() {
|
||||
os_archs=$(printf 'linux/%s\n' "${!QEMUARCHS[@]}")
|
||||
fi
|
||||
|
||||
pushd "${image}"
|
||||
alias_name="$(cat ALIAS 2>/dev/null || true)"
|
||||
if [[ -n "${alias_name}" ]]; then
|
||||
echo "Found an alias for '${image}'. Pushing image as '${alias_name}.'"
|
||||
image="${alias_name}"
|
||||
fi
|
||||
|
||||
kube::util::ensure-gnu-sed
|
||||
|
||||
# reset manifest list; needed in case multiple images are being built / pushed.
|
||||
@@ -223,6 +238,7 @@ push() {
|
||||
"${HOME}/.docker/manifests/${manifest_image_folder}/${manifest_image_folder}-${suffix}"
|
||||
fi
|
||||
done
|
||||
popd
|
||||
docker manifest push --purge "${REGISTRY}/${image}:${TAG}"
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user