From 97ecf165c1aada785d94427e14806cdbf5872606 Mon Sep 17 00:00:00 2001 From: Matt Wrock Date: Wed, 9 Nov 2022 11:57:49 -0800 Subject: [PATCH] support windows 2022 docker images Signed-off-by: Matt Wrock --- .expeditor/release_habitat.pipeline.yml | 8 ++++++++ .expeditor/scripts/release_habitat/build_docker_image.ps1 | 1 + components/core/src/util/docker.rs | 8 +++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.expeditor/release_habitat.pipeline.yml b/.expeditor/release_habitat.pipeline.yml index 6094bb33d9..1e0d61229b 100644 --- a/.expeditor/release_habitat.pipeline.yml +++ b/.expeditor/release_habitat.pipeline.yml @@ -470,6 +470,14 @@ steps: windows: os_version: 2019 + - label: ":docker: :windows: Upload windows 2022 container to Docker Hub" + if: build.creator.name == 'Chef Expeditor' || build.env("UPLOAD_AND_PROMOTE") == 'true' + command: .expeditor/scripts/release_habitat/publish_docker_studio.ps1 + expeditor: + executor: + windows: + os_version: 2022 + - wait - label: "[:habicat: Generate Manifest and promote to dev channel]" diff --git a/.expeditor/scripts/release_habitat/build_docker_image.ps1 b/.expeditor/scripts/release_habitat/build_docker_image.ps1 index d4e8879110..4574462c7b 100755 --- a/.expeditor/scripts/release_habitat/build_docker_image.ps1 +++ b/.expeditor/scripts/release_habitat/build_docker_image.ps1 @@ -29,6 +29,7 @@ function Get-DefaultTagForHost { 17134 { "1803" } 17763 { "ltsc2019" } 18362 { "1903" } + 20348 { "ltsc2022" } Default { Write-Error "Cannot determine the base image tag for this windows build ${osVersion.Build}" } } } diff --git a/components/core/src/util/docker.rs b/components/core/src/util/docker.rs index 1a56c77de6..f28e39be25 100644 --- a/components/core/src/util/docker.rs +++ b/components/core/src/util/docker.rs @@ -24,9 +24,10 @@ pub fn default_base_tag_for_host() -> Result<&'static str> { let info = os_info::get(); if String::from_utf8(result.stdout)?.trim() == "'hyperv'" { - // hyperv isolation can build any version so we will default to 2019 - // if the host supports it, otherwise 2016 - if *info.version() >= Semantic(10, 0, 17763) { + // Match hyperv windows image with host kernel + if *info.version() >= Semantic(10, 0, 20348) { + Ok("ltsc2022") + } else if *info.version() >= Semantic(10, 0, 17763) { Ok("ltsc2019") } else { Ok("ltsc2016") @@ -37,6 +38,7 @@ pub fn default_base_tag_for_host() -> Result<&'static str> { Semantic(10, 0, 17134) => Ok("1803"), Semantic(10, 0, 17763) => Ok("ltsc2019"), Semantic(10, 0, 18362) => Ok("1903"), + Semantic(10, 0, 20348) => Ok("ltsc2022"), unsupported_version => { Err(Error::UnsupportedDockerHostKernel(unsupported_version.to_string())) }