From 3cdb7a89cbb6266ef14a5607ad006e1452de9154 Mon Sep 17 00:00:00 2001 From: Claudiu Belu Date: Thu, 1 Aug 2019 16:08:51 -0700 Subject: [PATCH] test images: Adds multiple Windows channels support This commit adds support for building test images for multiple Windows versions, as we have to support both LTS and SAC channels. With this, the format for Windows images in the BASEIMAGE files is: OS/ARCH/OS_VERSION Also adds --isolation-hyperv to the Windows docker build command, making sure that container images for multiple OS versions can be built using the same Windows node. --- test/images/agnhost/BASEIMAGE | 4 +++- test/images/agnhost/README.md | 3 ++- test/images/busybox/BASEIMAGE | 4 +++- test/images/image-util.sh | 41 +++++++++++++++++++++++++---------- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/test/images/agnhost/BASEIMAGE b/test/images/agnhost/BASEIMAGE index 5fdb1fa08ea..cc7c45a7657 100644 --- a/test/images/agnhost/BASEIMAGE +++ b/test/images/agnhost/BASEIMAGE @@ -3,4 +3,6 @@ linux/arm=arm32v6/alpine:3.6 linux/arm64=arm64v8/alpine:3.6 linux/ppc64le=ppc64le/alpine:3.6 linux/s390x=s390x/alpine:3.6 -windows/amd64=REGISTRY/busybox:1.29-windows-amd64 +windows/amd64/1809=REGISTRY/busybox:1.29-windows-amd64-1809 +windows/amd64/1903=REGISTRY/busybox:1.29-windows-amd64-1903 +windows/amd64/1909=REGISTRY/busybox:1.29-windows-amd64-1909 diff --git a/test/images/agnhost/README.md b/test/images/agnhost/README.md index ce241dcd770..0b44449c231 100644 --- a/test/images/agnhost/README.md +++ b/test/images/agnhost/README.md @@ -639,4 +639,5 @@ The Windows `agnhost` image includes a `nc` binary that is 100% compliant with i ## Image The image can be found at `us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11` for both Linux and -Windows containers (based on `mcr.microsoft.com/windows/servercore:ltsc2019`). +Windows containers (based on `mcr.microsoft.com/windows/servercore:ltsc2019`, +`mcr.microsoft.com/windows/servercore:1903`, and `mcr.microsoft.com/windows/servercore:1909`). diff --git a/test/images/busybox/BASEIMAGE b/test/images/busybox/BASEIMAGE index 932c698c514..ce71d103b81 100644 --- a/test/images/busybox/BASEIMAGE +++ b/test/images/busybox/BASEIMAGE @@ -1 +1,3 @@ -windows/amd64=mcr.microsoft.com/windows/servercore:ltsc2019 +windows/amd64/1809=mcr.microsoft.com/windows/servercore:ltsc2019 +windows/amd64/1903=mcr.microsoft.com/windows/servercore:1903 +windows/amd64/1909=mcr.microsoft.com/windows/servercore:1909 diff --git a/test/images/image-util.sh b/test/images/image-util.sh index 3917aa67a8e..20278983696 100755 --- a/test/images/image-util.sh +++ b/test/images/image-util.sh @@ -36,9 +36,8 @@ listOsArchs() { # Returns baseimage need to used in Dockerfile for any given architecture getBaseImage() { - os_name=$1 - arch=$2 - grep "${os_name}/${arch}=" BASEIMAGE | cut -d= -f2 + os_arch=$1 + grep "${os_arch}=" BASEIMAGE | cut -d= -f2 } # This function will build test image for all the architectures @@ -57,7 +56,13 @@ build() { kube::util::ensure-gnu-sed for os_arch in ${os_archs}; do - if [[ $os_arch =~ .*/.* ]]; then + if [[ $os_arch =~ .*/.*/.* ]]; then + # for Windows, we have to support both LTS and SAC channels, so we're building multiple Windows images. + # the format for this case is: OS/ARCH/OS_VERSION. + os_name=$(echo "$os_arch" | cut -d "/" -f 1) + arch=$(echo "$os_arch" | cut -d "/" -f 2) + os_version=$(echo "$os_arch" | cut -d "/" -f 3) + elif [[ $os_arch =~ .*/.* ]]; then os_name=$(echo "$os_arch" | cut -d "/" -f 1) arch=$(echo "$os_arch" | cut -d "/" -f 2) else @@ -84,7 +89,7 @@ build() { TAG=$(