Skip to content

Commit

Permalink
chore: improve windows automation pipeline (#4686)
Browse files Browse the repository at this point in the history
  • Loading branch information
junjiezhang1997 authored Jul 23, 2024
1 parent d1ef147 commit afead9a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions vhdbuilder/release-notes/autonotes/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ var artifactToPath = map[string]string{
"2019-containerd": filepath.Join("AKSWindows", "2019-containerd"),
"2022-containerd": filepath.Join("AKSWindows", "2022-containerd"),
"2022-containerd-gen2": filepath.Join("AKSWindows", "2022-containerd-gen2"),
"23H2": filepath.Join("AKSWindows", "23H2"),
"23H2-gen2": filepath.Join("AKSWindows", "23H2-gen2"),
"azurelinuxv2-gen1": filepath.Join("AKSAzureLinux", "gen1"),
"azurelinuxv2-gen2": filepath.Join("AKSAzureLinux", "gen2"),
"azurelinuxv2-gen1-fips": filepath.Join("AKSAzureLinux", "gen1fips"),
Expand Down
7 changes: 4 additions & 3 deletions vhdbuilder/scripts/windows/automate_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ create_pull_request() {
else
post_purpose="bump windows image version"
title="feat: $post_purpose for ${image_version}B"
labels="\"windows\""
labels="\"windows\", \"VHD\""
fi

echo "to add git commit feat: $post_purpose for $image_version"
Expand All @@ -114,12 +114,13 @@ create_pull_request() {
# modify .github/PULL_REQUEST_TEMPLATE.md after pushing the pervious changes in created branch
if [[ $pr_purpose == "ReleaseNotes" ]]; then
sed -i "/What type of PR is this?/a\/kind documentation" .github/PULL_REQUEST_TEMPLATE.md
sed -i "/What this PR does/a\Add windows image release notes for new AKS Windows images with ${image_version}B" .github/PULL_REQUEST_TEMPLATE.md
sed -i "/What this PR does/a\Add windows image release notes for new AKS Windows images with ${image_version}B. Reference: #[xxxxx]." .github/PULL_REQUEST_TEMPLATE.md
sed -i 's/\[ \] uses/\[x\] uses/g' .github/PULL_REQUEST_TEMPLATE.md
sed -i 's/\[ \] includes/\[x\] includes/g' .github/PULL_REQUEST_TEMPLATE.md
body_content=$(sed 's/$/\\n/' .github/PULL_REQUEST_TEMPLATE.md | tr -d '\n')
else
sed -i "/What type of PR is this?/a\/kind feature" .github/PULL_REQUEST_TEMPLATE.md
sed -i "/What this PR does/a\Update Windows base images to ${image_version}B\\n- Windows 2019: [xxxxx]()\\n- Windows 2022: [xxxxx]()" .github/PULL_REQUEST_TEMPLATE.md
sed -i "/What this PR does/a\Update Windows base images to ${image_version}B\\n- Windows 2019: [xxxxx]()\\n- Windows 2022: [xxxxx]()\\n- Windows 23H2: [xxxxx]()" .github/PULL_REQUEST_TEMPLATE.md
sed -i 's/\[ \] uses/\[x\] uses/g' .github/PULL_REQUEST_TEMPLATE.md
body_content=$(sed 's/$/\\n/' .github/PULL_REQUEST_TEMPLATE.md | tr -d '\n')
fi
Expand Down
10 changes: 10 additions & 0 deletions vhdbuilder/scripts/windows/automate_version_bump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ find_latest_image_version() {
latest_image_version_2019=$(az vm image show --urn MicrosoftWindowsServer:WindowsServer:2019-Datacenter-Core-smalldisk:latest --query 'id' -o tsv | awk -F '/' '{print $NF}')
latest_image_version_2022=$(az vm image show --urn MicrosoftWindowsServer:WindowsServer:2022-Datacenter-Core-smalldisk:latest --query 'id' -o tsv | awk -F '/' '{print $NF}')
latest_image_version_2022_g2=$(az vm image show --urn MicrosoftWindowsServer:WindowsServer:2022-Datacenter-Core-smalldisk-g2:latest --query 'id' -o tsv | awk -F '/' '{print $NF}')
latest_image_version_23H2=$(az vm image show --urn MicrosoftWindowsServer:WindowsServer:23h2-datacenter-core:latest --query 'id' -o tsv | awk -F '/' '{print $NF}')
latest_image_version_23H2_g2=$(az vm image show --urn MicrosoftWindowsServer:WindowsServer:23h2-datacenter-core-g2:latest --query 'id' -o tsv | awk -F '/' '{print $NF}')
echo "Latest windows 2019 base image version is: ${latest_image_version_2019}"
echo "Latest windows 2022 base image version is: ${latest_image_version_2022}"
echo "Latest windows 2022 Gen 2 base image version is: ${latest_image_version_2022_g2}"
echo "Latest windows 23H2 base image version is ${latest_image_version_23H2}"
echo "Latest windows 23H2 Gen 2 base image version is: ${latest_image_version_23H2_g2}"
new_image_version=$(date +"%Y-%m")
branch_name=$github_user_name/win-${new_image_version}b
}
Expand All @@ -38,6 +42,12 @@ update_image_version() {

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_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_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
}

cherry_pick() {
Expand Down

0 comments on commit afead9a

Please sign in to comment.