Skip to content

Commit 2f52daa

Browse files
authored
Switches windows builds to base off new base image (#1569)
1 parent a30fad8 commit 2f52daa

File tree

7 files changed

+10
-19
lines changed

7 files changed

+10
-19
lines changed

Common.mk

+3-6
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ IMAGE_TARGETS=$(foreach image,$(IMAGE_NAMES),$(if $(filter true,$(BUILD_OCI_TARS
176176

177177
############# WINDOWS #############################
178178
# similiar to https://github.com/kubernetes-csi/livenessprobe/blob/master/release-tools/prow.sh#L78
179-
WINDOWS_IMAGE_REGISTRY=mcr.microsoft.com/windows
180-
WINDOWS_BASE_IMAGE_NAME=nanoserver
181-
WINDOWS_ADDON_IMAGE_NAME=servercore
182179
WINDOWS_IMAGE_VERSIONS=1809 20H2 ltsc2022
183180

184181
# if multiple platforms requested, remove windows since it will be
@@ -668,7 +665,7 @@ endif
668665
%/images/push: $(BINARY_TARGETS) $(LICENSES_TARGETS_FOR_PREREQ) $(HANDLE_DEPENDENCIES_TARGET) $$(WINDOWS_IMAGE_BUILD_TARGETS_FOR_IMAGE)
669666
$(BUILDCTL)
670667
@if [ -n "$(WINDOWS_IMAGE_BUILD_TARGETS_FOR_IMAGE)" ]; then \
671-
$(BUILD_LIB)/create_windows_manifest_list.sh $(IMAGE_NAME) $(IMAGE) $(LATEST_IMAGE) "$(WINDOWS_IMAGE_VERSIONS)" $(WINDOWS_IMAGE_REGISTRY) $(WINDOWS_BASE_IMAGE_NAME); \
668+
$(BUILD_LIB)/create_windows_manifest_list.sh $(IMAGE_NAME) $(IMAGE) $(LATEST_IMAGE) "$(WINDOWS_IMAGE_VERSIONS)"; \
672669
fi
673670

674671
%/images/amd64: $(BINARY_TARGETS) $(LICENSES_TARGETS_FOR_PREREQ) $(HANDLE_DEPENDENCIES_TARGET)
@@ -684,8 +681,8 @@ endif
684681
%/windows/images/push: IMAGE_NAME=$(word 1,$(subst ., ,$*))
685682
%/windows/images/push: WINDOWS_OS_VERSION=$(word 2,$(subst ., ,$*))
686683
%/windows/images/push: DOCKERFILE_FOLDER=./docker/windows
687-
%/windows/images/push: BUILDER_IMAGE=$(WINDOWS_IMAGE_REGISTRY)/$(WINDOWS_ADDON_IMAGE_NAME):$(WINDOWS_OS_VERSION)
688-
%/windows/images/push: BASE_IMAGE=$(WINDOWS_IMAGE_REGISTRY)/$(WINDOWS_BASE_IMAGE_NAME):$(WINDOWS_OS_VERSION)
684+
%/windows/images/push: BASE_IMAGE_NAME=eks-distro-windows-base-$(WINDOWS_OS_VERSION)
685+
%/windows/images/push: BASE_IMAGE=$(BASE_IMAGE_REPO)/eks-distro-windows-base:$(BASE_IMAGE_TAG)
689686
%/windows/images/push: IMAGE_PLATFORMS=windows/amd64
690687
%/windows/images/push: IMAGE_METADATA_FILE=/tmp/$(IMAGE_NAME)-$(WINDOWS_OS_VERSION)-metadata.json
691688
%/windows/images/push: $(BINARY_TARGETS) $(LICENSES_TARGETS_FOR_PREREQ) $(HANDLE_DEPENDENCIES_TARGET)

EKS_DISTRO_WINDOWS_BASE_1809_TAG_FILE

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1809-2022-12-19-1671485888.2

EKS_DISTRO_WINDOWS_BASE_20H2_TAG_FILE

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20H2-2022-12-19-1671485888.2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ltsc2022-2022-12-19-1671485888.2

build/lib/create_windows_manifest_list.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ IMAGE_NAME="$1"
2424
IMAGE="$2"
2525
LATEST_IMAGE="$3"
2626
WINDOWS_IMAGE_VERSIONS="$4"
27-
WINDOWS_IMAGE_REGISTRY="$5"
28-
WINDOWS_BASE_IMAGE_NAME="$6"
2927

3028
# this metadate file contains the linux/amd+arm images
3129
if [ ! -f /tmp/$IMAGE_NAME-metadata.json ]; then
@@ -43,9 +41,12 @@ for version in "${VERSIONS[@]}"; do
4341
echo "No metadata file for image: /tmp/$IMAGE_NAME-$version-metadata.json!"
4442
exit 1
4543
fi
44+
45+
BASE_IMAGE=$(jq -r '."containerimage.buildinfo".attrs."build-arg:BASE_IMAGE"' /tmp/$IMAGE_NAME-$version-metadata.json)
46+
4647
# need to remove mediaType from descri since buildx segfaults when it is set
4748
jq -r '."containerimage.descriptor" | {size, digest}' /tmp/$IMAGE_NAME-$version-metadata.json > /tmp/$IMAGE_NAME-$version-descr.json
48-
retry docker buildx imagetools inspect --raw $WINDOWS_IMAGE_REGISTRY/$WINDOWS_BASE_IMAGE_NAME:$version | jq '.manifests[0] | {platform}' | jq add -s - /tmp/$IMAGE_NAME-$version-descr.json > /tmp/$IMAGE_NAME-$version-descr-final.json
49+
retry docker buildx imagetools inspect --raw $BASE_IMAGE | jq '.manifests[0] | {platform}' | jq add -s - /tmp/$IMAGE_NAME-$version-descr.json > /tmp/$IMAGE_NAME-$version-descr-final.json
4950
CREATE_ARGS+="-f /tmp/$IMAGE_NAME-$version-descr-final.json "
5051
done
5152

projects/kubernetes-csi/livenessprobe/docker/windows/Dockerfile

-5
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
ARG BUILDER_IMAGE
1615
ARG BASE_IMAGE
17-
FROM $BUILDER_IMAGE as servercore
1816
FROM $BASE_IMAGE
1917

20-
COPY --from=servercore /Windows/System32/netapi32.dll /Windows/System32/netapi32.dll
21-
2218
ARG TARGETARCH
2319
ARG TARGETOS
2420

25-
2621
COPY LICENSES /LICENSES
2722
COPY ATTRIBUTION.txt /ATTRIBUTION.txt
2823
COPY bin/livenessprobe/$TARGETOS-$TARGETARCH/livenessprobe.exe /livenessprobe.exe

projects/kubernetes-csi/node-driver-registrar/docker/windows/Dockerfile

-5
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
ARG BUILDER_IMAGE
1615
ARG BASE_IMAGE
17-
FROM $BUILDER_IMAGE as servercore
1816
FROM $BASE_IMAGE
1917

20-
COPY --from=servercore /Windows/System32/netapi32.dll /Windows/System32/netapi32.dll
21-
2218
ARG TARGETARCH
2319
ARG TARGETOS
2420

25-
2621
COPY LICENSES /LICENSES
2722
COPY ATTRIBUTION.txt /ATTRIBUTION.txt
2823
COPY bin/node-driver-registrar/$TARGETOS-$TARGETARCH/csi-node-driver-registrar.exe /csi-node-driver-registrar.exe

0 commit comments

Comments
 (0)