mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
pause: encode Windows OS version in image tag instead of repository
Signed-off-by: Ernest Wong <chuwon@microsoft.com>
This commit is contained in:
parent
e456b45a2a
commit
747eec42fe
@ -16,9 +16,8 @@
|
||||
|
||||
REGISTRY ?= staging-k8s.gcr.io
|
||||
IMAGE = $(REGISTRY)/pause
|
||||
IMAGE_WITH_OS_ARCH = $(IMAGE)-$(OS)-$(ARCH)
|
||||
|
||||
TAG = 3.4
|
||||
TAG = 3.4.1
|
||||
REV = $(shell git describe --contains --always --match='v*')
|
||||
|
||||
# Architectures supported: amd64, arm, arm64, ppc64le and s390x
|
||||
@ -83,8 +82,8 @@ all: all-container-docker
|
||||
all-push: all-container-registry push-manifest
|
||||
|
||||
push-manifest:
|
||||
docker manifest create --amend $(IMAGE):$(TAG) $(shell echo $(ALL_OS_ARCH) | sed -e "s~[^ ]*~$(IMAGE)\-&:$(TAG)~g")
|
||||
set -x; for arch in $(ALL_ARCH.linux); do docker manifest annotate --os linux --arch $${arch} ${IMAGE}:${TAG} ${IMAGE}-linux-$${arch}:${TAG}; done
|
||||
docker manifest create --amend $(IMAGE):$(TAG) $(shell echo $(ALL_OS_ARCH) | sed -e "s~[^ ]*~$(IMAGE):$(TAG)\-&~g")
|
||||
set -x; for arch in $(ALL_ARCH.linux); do docker manifest annotate --os linux --arch $${arch} ${IMAGE}:${TAG} ${IMAGE}:${TAG}-linux-$${arch}; done
|
||||
# For Windows images, we also need to include the "os.version" in the manifest list, so the Windows node can pull the proper image it needs.
|
||||
# At the moment, docker manifest annotate doesn't allow us to set the os.version, so we'll have to it ourselves. The manifest list can be found locally as JSONs.
|
||||
# See: https://github.com/moby/moby/issues/41417
|
||||
@ -97,10 +96,10 @@ push-manifest:
|
||||
manifest_image_folder=`echo "$${registry_prefix}${IMAGE}" | sed "s|/|_|g" | sed "s/:/-/"`; \
|
||||
for arch in $(ALL_ARCH.windows); do \
|
||||
for osversion in ${ALL_OSVERSIONS.windows}; do \
|
||||
docker manifest annotate --os windows --arch $${arch} ${IMAGE}:${TAG} ${IMAGE}-windows-$${arch}-$${osversion}:${TAG}; \
|
||||
docker manifest annotate --os windows --arch $${arch} ${IMAGE}:${TAG} ${IMAGE}:${TAG}-windows-$${arch}-$${osversion}; \
|
||||
BASEIMAGE=${BASE.windows}:$${osversion}; \
|
||||
full_version=`docker manifest inspect ${BASE.windows}:$${osversion} | grep "os.version" | head -n 1 | awk '{print $$2}'` || true; \
|
||||
sed -i -r "s/(\"os\"\:\"windows\")/\0,\"os.version\":$${full_version}/" "${HOME}/.docker/manifests/$${manifest_image_folder}-${TAG}/$${manifest_image_folder}-windows-$${arch}-$${osversion}-${TAG}"; \
|
||||
sed -i -r "s/(\"os\"\:\"windows\")/\0,\"os.version\":$${full_version}/" "${HOME}/.docker/manifests/$${manifest_image_folder}-${TAG}/$${manifest_image_folder}-${TAG}-windows-$${arch}-$${osversion}"; \
|
||||
done; \
|
||||
done
|
||||
docker manifest push --purge ${IMAGE}:${TAG}
|
||||
@ -130,12 +129,12 @@ bin/wincat-windows-${ARCH}: windows/wincat/wincat.go
|
||||
container: .container-${OS}-$(ARCH)
|
||||
.container-linux-$(ARCH): bin/$(BIN)-$(OS)-$(ARCH)
|
||||
docker buildx build --pull --output=type=${OUTPUT_TYPE} --platform ${OS}/$(ARCH) \
|
||||
-t $(IMAGE_WITH_OS_ARCH):$(TAG) --build-arg BASE=${BASE} --build-arg ARCH=$(ARCH) .
|
||||
-t $(IMAGE):$(TAG)-${OS}-$(ARCH) --build-arg BASE=${BASE} --build-arg ARCH=$(ARCH) .
|
||||
touch $@
|
||||
|
||||
.container-windows-$(ARCH): $(foreach binary, ${BIN}, bin/${binary}-${OS}-${ARCH})
|
||||
docker buildx build --pull --output=type=${OUTPUT_TYPE} --platform ${OS}/$(ARCH) \
|
||||
-t $(IMAGE_WITH_OS_ARCH)-${OSVERSION}:$(TAG) --build-arg BASE=${BASE}:${OSVERSION} --build-arg ARCH=$(ARCH) -f Dockerfile_windows .
|
||||
-t $(IMAGE):$(TAG)-${OS}-$(ARCH)-${OSVERSION} --build-arg BASE=${BASE}:${OSVERSION} --build-arg ARCH=$(ARCH) -f Dockerfile_windows .
|
||||
touch $@
|
||||
|
||||
# Useful for testing, not automatically included in container image
|
||||
|
Loading…
Reference in New Issue
Block a user