Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: change hard coded windows image versions to using the latest versions #5452

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pipelines/.vsts-vhd-builder-release-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pr:
- vhdbuilder/packer/convert-sig-to-classic-storage-account-blob.sh
- vhdbuilder/packer/generate-vhd-publishing-info.sh
- vhdbuilder/packer/init-variables.sh
- vhdbuilder/packer/windows-image.env
- vhdbuilder/packer/windows-image.env.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you plan to release new AKS Windows images with non-security changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release is a separate process - but I do want to build them automatically.

There's also the need to set registry keys in the VHDs to enable any fixes for AKS. That'll have to be manual, sadly.

- vhdbuilder/packer/windows-vhd-builder-sig.json

pool:
Expand Down
11 changes: 6 additions & 5 deletions vhdbuilder/packer/init-variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,10 @@ fi
# shellcheck disable=SC2236
if [ "$OS_TYPE" == "Windows" ]; then
imported_windows_image_name=""
source $CDIR/windows-image.env

echo "Set the base image sku and version from windows-image.env"
source $CDIR/windows-image.env.sh

echo "Set the base image sku and version from windows-image.env.sh"
case "${WINDOWS_SKU}" in
"2019")
WINDOWS_IMAGE_SKU=$WINDOWS_2019_BASE_IMAGE_SKU
Expand All @@ -345,7 +346,7 @@ if [ "$OS_TYPE" == "Windows" ]; then

echo "Set OS disk size"
if [ -n "${WINDOWS_2019_OS_DISK_SIZE_GB}" ]; then
echo "Setting os_disk_size_gb to the value in windows-image.env for 2019 Docker: ${WINDOWS_2019_OS_DISK_SIZE_GB}"
echo "Setting os_disk_size_gb to the value in windows-image.env.sh for 2019 Docker: ${WINDOWS_2019_OS_DISK_SIZE_GB}"
os_disk_size_gb=${WINDOWS_2019_OS_DISK_SIZE_GB}
fi
;;
Expand All @@ -356,7 +357,7 @@ if [ "$OS_TYPE" == "Windows" ]; then

echo "Set OS disk size"
if [ -n "${WINDOWS_2019_CONTAINERD_OS_DISK_SIZE_GB}" ]; then
echo "Setting os_disk_size_gb to the value in windows-image.env for 2019 Containerd: ${WINDOWS_2019_CONTAINERD_OS_DISK_SIZE_GB}"
echo "Setting os_disk_size_gb to the value in windows-image.env.sh for 2019 Containerd: ${WINDOWS_2019_CONTAINERD_OS_DISK_SIZE_GB}"
os_disk_size_gb=${WINDOWS_2019_CONTAINERD_OS_DISK_SIZE_GB}
fi
;;
Expand Down Expand Up @@ -398,7 +399,7 @@ if [ "$OS_TYPE" == "Windows" ]; then
;;
esac

# Create the sig image from the official images defined in windows-image.env by default
# Create the sig image from the official images defined in windows-image.env.sh by default
windows_sigmode_source_subscription_id=""
windows_sigmode_source_resource_group_name=""
windows_sigmode_source_gallery_name=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,24 @@ WINDOWS_2019_BASE_IMAGE_SKU=2019-Datacenter-Core-smalldisk
# TODO: update global:patch in generate-windows-vhd-configuration.ps1 and remove this comment when you bump 12B
# - but revert and bring back if open ssh fails when you build the VHD. This image is 9B.
WINDOWS_2019_BASE_IMAGE_VERSION=17763.6293.240905
#WINDOWS_2019_BASE_IMAGE_VERSION=$(az vm image show --urn "MicrosoftWindowsServer:WindowsServer:${WINDOWS_2019_BASE_IMAGE_SKU}:latest" | jq -r .name)

# CLI example to get the latest image version:
# az vm image show --urn MicrosoftWindowsServer:WindowsServer:2022-Datacenter-Core-smalldisk:latest
WINDOWS_2022_BASE_IMAGE_SKU=2022-Datacenter-Core-smalldisk
WINDOWS_2022_BASE_IMAGE_VERSION=20348.2966.241205
WINDOWS_2022_BASE_IMAGE_VERSION=$(az vm image show --urn "MicrosoftWindowsServer:WindowsServer:${2022-Datacenter-Core-smalldisk}:latest" | jq -r .name)

# CLI example to get all available image version under a SKU (suffix g2 for Gen 2):
# az vm image list --all --publisher MicrosoftWindowsServer --offer WindowsServer --output table -s 2022-datacenter-core-smalldisk-g2
# CLI example to get the latest image version:
# az vm image show --urn MicrosoftWindowsServer:WindowsServer:2022-datacenter-core-smalldisk-g2:latest

WINDOWS_2022_GEN2_BASE_IMAGE_SKU=2022-datacenter-core-smalldisk-g2
WINDOWS_2022_GEN2_BASE_IMAGE_VERSION=20348.2966.241205
WINDOWS_2022_GEN2_BASE_IMAGE_VERSION=$(az vm image show --urn "MicrosoftWindowsServer:WindowsServer:${WINDOWS_2022_GEN2_BASE_IMAGE_SKU}:latest" | jq -r .name)

# CLI example to get the latest image version:
# az vm image show --urn MicrosoftWindowsServer:WindowsServer:23h2-datacenter-core:latest
WINDOWS_23H2_BASE_IMAGE_SKU=23h2-datacenter-core
WINDOWS_23H2_BASE_IMAGE_VERSION=25398.1308.241205
WINDOWS_23H2_BASE_IMAGE_VERSION=$(az vm image show --urn "MicrosoftWindowsServer:${WINDOWS_23H2_BASE_IMAGE_SKU}:latest" | jq -r .name)

# CLI example to get all available image version under a SKU (suffix g2 for Gen 2):
# az vm image list --all --publisher MicrosoftWindowsServer --offer WindowsServer --output table -s 23h2-datacenter-core-g2
# CLI example to get the latest image version:
# az vm image show --urn MicrosoftWindowsServer:WindowsServer:23h2-datacenter-core-g2:latest
# NOTE: Please update $global:patchUrls and $global:patchIDs in vhdbuilder/packer/generate-windows-vhd-configuration.ps1 on demand
WINDOWS_23H2_GEN2_BASE_IMAGE_SKU=23h2-datacenter-core-g2
WINDOWS_23H2_GEN2_BASE_IMAGE_VERSION=25398.1308.241205
WINDOWS_23H2_GEN2_BASE_IMAGE_VERSION=$(az vm image show --urn "MicrosoftWindowsServer:WindowsServer:${WINDOWS_23H2_GEN2_BASE_IMAGE_SKU}:latest" | jq -r .name)

# Please uncomment the following lines and set a larger os disk size that is at least 30GB when your PR check-in fails
# WINDOWS_2019_CONTAINERD_OS_DISK_SIZE_GB=30
Expand Down
33 changes: 21 additions & 12 deletions vhdbuilder/scripts/windows/automate_version_bump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,31 @@ find_latest_image_version() {
branch_name=imageBump/win-${new_image_version}b
}

# This function replaces the old Windows 2019 & Windows 2022 (gen1/gen2) base image version with the latest version found by az vm image show in windows-image.env
# This function replaces the old Windows 2019 & Windows 2022 (gen1/gen2) base image version with the latest version found by az vm image show in windows-image.env.sh
update_image_version() {
line=$(grep "WINDOWS_2019_BASE_IMAGE_VERSION=" vhdbuilder/packer/windows-image.env)
sed -i "s/$line/WINDOWS_2019_BASE_IMAGE_VERSION=$latest_image_version_2019/g" vhdbuilder/packer/windows-image.env

line=$(grep "WINDOWS_2022_BASE_IMAGE_VERSION=" vhdbuilder/packer/windows-image.env)
sed -i "s/$line/WINDOWS_2022_BASE_IMAGE_VERSION=$latest_image_version_2022/g" vhdbuilder/packer/windows-image.env
line=$(grep "WINDOWS_2019_BASE_IMAGE_VERSION=" vhdbuilder/packer/windows-image.env.sh)
if [[ "$line" != *"az vm image show"* ]]; then
sed -i "s/$line/WINDOWS_2019_BASE_IMAGE_VERSION=$latest_image_version_2019/g" vhdbuilder/packer/windows-image.env.sh
fi

line=$(grep "WINDOWS_2022_GEN2_BASE_IMAGE_VERSION=" vhdbuilder/packer/windows-image.env)
sed -i "s/$line/WINDOWS_2022_GEN2_BASE_IMAGE_VERSION=$latest_image_version_2022_g2/g" vhdbuilder/packer/windows-image.env
line=$(grep "WINDOWS_2022_BASE_IMAGE_VERSION=" vhdbuilder/packer/windows-image.env.sh)
if [[ "$line" != *"az vm image show"* ]]; then
sed -i "s/$line/WINDOWS_2022_BASE_IMAGE_VERSION=$latest_image_version_2022/g" vhdbuilder/packer/windows-image.env.sh
fi
line=$(grep "WINDOWS_2022_GEN2_BASE_IMAGE_VERSION=" vhdbuilder/packer/windows-image.env.sh)
if [[ "$line" != *"az vm image show"* ]]; then
sed -i "s/$line/WINDOWS_2022_GEN2_BASE_IMAGE_VERSION=$latest_image_version_2022_g2/g" vhdbuilder/packer/windows-image.env.sh
fi

line=$(grep "WINDOWS_23H2_BASE_IMAGE_VERSION=" vhdbuilder/packer/windows-image.env)
sed -i "s/$line/WINDOWS_23H2_BASE_IMAGE_VERSION=$latest_image_version_23H2/g" vhdbuilder/packer/windows-image.env
line=$(grep "WINDOWS_23H2_BASE_IMAGE_VERSION=" vhdbuilder/packer/windows-image.env.sh)
if [[ "$line" != *"az vm image show"* ]]; then
sed -i "s/$line/WINDOWS_23H2_BASE_IMAGE_VERSION=$latest_image_version_23H2/g" vhdbuilder/packer/windows-image.env.sh
fi

line=$(grep "WINDOWS_23H2_GEN2_BASE_IMAGE_VERSION=" vhdbuilder/packer/windows-image.env)
sed -i "s/$line/WINDOWS_23H2_GEN2_BASE_IMAGE_VERSION=$latest_image_version_23H2_g2/g" vhdbuilder/packer/windows-image.env
line=$(grep "WINDOWS_23H2_GEN2_BASE_IMAGE_VERSION=" vhdbuilder/packer/windows-image.env.sh)
if [[ "$line" != *"az vm image show"* ]]; then
sed -i "s/$line/WINDOWS_23H2_GEN2_BASE_IMAGE_VERSION=$latest_image_version_23H2_g2/g" vhdbuilder/packer/windows-image.env.sh
fi
}

cherry_pick() {
Expand Down
Loading