mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-17 23:19:26 +00:00
upstream heptio/kube-conformance
Pick up some code from https://github.com/heptio/kube-conformance Fix up build scripts for the new conformance image Fix Header template and Copyright to make verify job go green update README and add execute permissions for script Change-Id: Ib6509acd816cc2fb3a516bfb8e0ff9e32bff8f79
This commit is contained in:
@@ -29,6 +29,7 @@ readonly RELEASE_TARS="${LOCAL_OUTPUT_ROOT}/release-tars"
|
||||
readonly RELEASE_IMAGES="${LOCAL_OUTPUT_ROOT}/release-images"
|
||||
|
||||
KUBE_BUILD_HYPERKUBE=${KUBE_BUILD_HYPERKUBE:-y}
|
||||
KUBE_BUILD_CONFORMANCE=${KUBE_BUILD_CONFORMANCE:-y}
|
||||
|
||||
# Validate a ci version
|
||||
#
|
||||
@@ -289,15 +290,28 @@ function kube::release::build_hyperkube_image() {
|
||||
if [[ -n "${save_dir}" ]]; then
|
||||
"${DOCKER[@]}" save "${hyperkube_tag}" > "${save_dir}/hyperkube-${arch}.tar"
|
||||
fi
|
||||
if [[ -z "${KUBE_DOCKER_IMAGE_TAG-}" || -z "${KUBE_DOCKER_REGISTRY-}" ]]; then
|
||||
# not a release
|
||||
kube::log::status "Deleting hyperkube image ${hyperkube_tag}"
|
||||
"${DOCKER[@]}" rmi "${hyperkube_tag}" &>/dev/null || true
|
||||
fi
|
||||
kube::log::status "Deleting hyperkube image ${hyperkube_tag}"
|
||||
"${DOCKER[@]}" rmi "${hyperkube_tag}" &>/dev/null || true
|
||||
}
|
||||
|
||||
# This will take binaries that run on master and creates Docker images
|
||||
# that wrap the binary in them. (One docker image per binary)
|
||||
function kube::release::build_conformance_image() {
|
||||
local -r arch="$1"
|
||||
local -r registry="$2"
|
||||
local -r version="$3"
|
||||
local -r save_dir="${4-}"
|
||||
kube::log::status "Building conformance image for arch: ${arch}"
|
||||
ARCH="${arch}" REGISTRY="${registry}" VERSION="${version}" \
|
||||
make -C cluster/images/conformance/ build >/dev/null
|
||||
|
||||
local conformance_tag="${registry}/conformance-${arch}:${version}"
|
||||
if [[ -n "${save_dir}" ]]; then
|
||||
"${DOCKER[@]}" save "${conformance_tag}" > "${save_dir}/conformance-${arch}.tar"
|
||||
fi
|
||||
kube::log::status "Deleting conformance image ${conformance_tag}"
|
||||
"${DOCKER[@]}" rmi "${conformance_tag}" &>/dev/null || true
|
||||
}
|
||||
|
||||
# This builds all the release docker images (One docker image per binary)
|
||||
# Args:
|
||||
# $1 - binary_dir, the directory to save the tared images to.
|
||||
# $2 - arch, architecture for which we are building docker images.
|
||||
@@ -395,6 +409,10 @@ EOF
|
||||
kube::release::build_hyperkube_image "${arch}" "${docker_registry}" \
|
||||
"${docker_tag}" "${images_dir}" &
|
||||
fi
|
||||
if [[ "${KUBE_BUILD_CONFORMANCE}" =~ [yY] ]]; then
|
||||
kube::release::build_conformance_image "${arch}" "${docker_registry}" \
|
||||
"${docker_tag}" "${images_dir}" &
|
||||
fi
|
||||
|
||||
kube::util::wait-for-jobs || { kube::log::error "previous Docker build failed"; return 1; }
|
||||
kube::log::status "Docker builds done"
|
||||
|
Reference in New Issue
Block a user