From 2959cd2193af9ed18d0fc2912fc5c11d6462103d Mon Sep 17 00:00:00 2001 From: Brooks Newberry Date: Mon, 28 Oct 2024 09:06:25 -0700 Subject: [PATCH] [release-1.30] Fix publish windows runtime (#7146) * support windows platform in builder Signed-off-by: Brooks Newberry * update windows image pull filter Signed-off-by: Brooks Newberry * publish manifest with buildx imagetools Signed-off-by: Brooks Newberry --------- Signed-off-by: Brooks Newberry --- Dockerfile.windows | 5 +++-- scripts/package-windows-images | 8 ++++---- scripts/publish-image-runtime-windows | 1 + scripts/publish-manifest-runtime | 16 +++++----------- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Dockerfile.windows b/Dockerfile.windows index f2c65dfc73..941207984a 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -1,4 +1,4 @@ -FROM alpine:3.20 AS build +FROM --platform=$BUILDPLATFORM alpine:3.20 AS build RUN apk --no-cache add \ curl \ @@ -38,7 +38,7 @@ RUN curl -sL https://raw.githubusercontent.com/golangci/golangci-lint/master/ins WORKDIR /source # End Dapper stuff -FROM rancher/hardened-containerd:v1.7.22-k3s1-build20241010-amd64-windows AS containerd +FROM --platform=$BUILDPLATFORM rancher/hardened-containerd:v1.7.22-k3s1-build20241010-amd64-windows AS containerd FROM build as windows-runtime-collect ARG KUBERNETES_VERSION=dev @@ -107,6 +107,7 @@ RUN mv CalicoWindows/confd confd/ FROM scratch AS windows-runtime LABEL org.opencontainers.image.url="https://hub.docker.com/r/rancher/rke2-runtime" LABEL org.opencontainers.image.source="https://github.com/rancher/rke2" +WORKDIR /bin/ COPY --from=containerd /usr/local/bin/*.exe /bin/ COPY --from=windows-runtime-collect ./rancher/* /bin/ COPY --from=windows-runtime-collect ./confd/ /bin/confd diff --git a/scripts/package-windows-images b/scripts/package-windows-images index e70ad0ffa6..adf28df295 100755 --- a/scripts/package-windows-images +++ b/scripts/package-windows-images @@ -8,15 +8,15 @@ source ./scripts/version.sh mkdir -p dist/artifacts # ltsc1809 / Server 2019 1809 -crane pull --platform windows/amd64:10.0.17763.2114 \ +crane pull --platform windows/amd64 \ ${REGISTRY}/${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64 \ - ${REGISTRY}/${REPO}/mirrored-pause:${PAUSE_VERSION} \ + ${REGISTRY}/${REPO}/mirrored-pause:${PAUSE_VERSION}-amd64-windows-10.0.17763.2114 \ rke2-windows-1809-amd64-images.tar # ltsc2022 / Server 2022 21H2 -crane pull --platform windows/amd64:10.0.20348.169 \ +crane pull --platform windows/amd64 \ ${REGISTRY}/${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64 \ - ${REGISTRY}/${REPO}/mirrored-pause:${PAUSE_VERSION} \ + ${REGISTRY}/${REPO}/mirrored-pause:${PAUSE_VERSION}-amd64-windows-10.0.20348.169 \ rke2-windows-ltsc2022-amd64-images.tar WINDOWS_TARFILES=(rke2-windows-1809-amd64-images.tar rke2-windows-ltsc2022-amd64-images.tar) diff --git a/scripts/publish-image-runtime-windows b/scripts/publish-image-runtime-windows index e435ad6f81..695b1eb000 100755 --- a/scripts/publish-image-runtime-windows +++ b/scripts/publish-image-runtime-windows @@ -16,5 +16,6 @@ docker buildx build ${IID_FILE_FLAG} \ --tag ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64 \ --target windows-runtime \ --file Dockerfile.windows \ + --platform windows/amd64 \ --push \ . diff --git a/scripts/publish-manifest-runtime b/scripts/publish-manifest-runtime index 3cc3068d39..9381111373 100755 --- a/scripts/publish-manifest-runtime +++ b/scripts/publish-manifest-runtime @@ -6,21 +6,15 @@ cd $(dirname $0)/.. source ./scripts/version.sh export DOCKER_CLI_EXPERIMENTAL=enabled -docker manifest create \ - ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} \ - ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-amd64 \ - ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-arm64 \ - ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64 - -docker manifest annotate ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-amd64 --os linux --arch amd64 -docker manifest annotate ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-arm64 --os linux --arch arm64 -docker manifest annotate ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64 --os windows --arch amd64 - set +x docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD set -x -docker manifest push ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} +docker buildx imagetools create \ + --tag ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} \ + ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-amd64 \ + ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-arm64 \ + ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64 if [ -n "${IID_FILE}" ]; then docker buildx imagetools inspect --format "{{json .Manifest}}" ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} | jq -r '.digest' > ${IID_FILE}