Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
603816e
log output folder
bobsira Jun 24, 2025
56de3e1
added my azure credentials
bobsira Jun 30, 2025
a9cb4a6
elevated ps commands
bobsira Jun 30, 2025
dab4aef
added logging commands
bobsira Jul 1, 2025
7579378
minor logging addition
bobsira Jul 1, 2025
6a5cae2
added required packer block
bobsira Jul 1, 2025
deb3d99
Trigger workflow after fixing permissions
bobsira Jul 1, 2025
06ce718
Trigger workflow after fixing permission
bobsira Jul 2, 2025
1f961a7
Trigger workflow after fixing permission
bobsira Jul 2, 2025
a32931f
removed a few lines
bobsira Jul 2, 2025
9020375
changed the searched folder
bobsira Jul 2, 2025
6173503
Update GitHub Actions workflow to set WINDOWS_VERSION and KUBERNETES_…
bobsira Aug 5, 2025
757075d
fixed windows serverversion lookup functionality
bobsira Aug 6, 2025
eb83cb3
string mismatch fix
bobsira Aug 6, 2025
b2220bb
reversed back to the correct order of the types
bobsira Aug 6, 2025
2dc3f51
removed the echo statements
bobsira Aug 10, 2025
c63729a
bumped up k8 version
bobsira Jan 25, 2026
fc9e525
fixed lint issues
bobsira Jan 25, 2026
0f7d330
buid with k8 v1350
bobsira Feb 4, 2026
129509c
removed unrequired space
bobsira Feb 20, 2026
2ec90d6
cleaning up for porting over to minikube repo
bobsira Feb 24, 2026
8de38c3
Merge branch 'user/vhd_pipeline_automation' of https://github.com/bob…
bobsira Feb 24, 2026
27aa8aa
added powershell - shell
bobsira Feb 24, 2026
4e27f30
fixing the quotation marks
bobsira Feb 24, 2026
608161d
adding more detailed logging
bobsira Feb 24, 2026
3024110
testing logging and mounting
bobsira Feb 24, 2026
5af5d5c
more log fixes
bobsira Feb 24, 2026
c99e442
fixed concat issues
bobsira Feb 24, 2026
70940b0
revert back
bobsira Feb 24, 2026
362c0f3
fixed vhd locator issues
bobsira Feb 24, 2026
6795362
fixed host/guest mismatch
bobsira Feb 25, 2026
257c90e
admin priv for workflow
bobsira Feb 25, 2026
0ca132e
removed mouting script
bobsira Feb 27, 2026
8facdb0
clean up
bobsira Feb 27, 2026
332b97a
bump containerd to 2.2.3 and fix CNI path patching for 2.x config format
bobsira Apr 23, 2026
f7d43c9
Merge branch 'main' into user/vhd_pipeline_automation
bobsira Jun 16, 2026
14025d1
Update Kubernetes to v1.37.0
bobsira Sep 10, 2026
900a4c1
Fix duplicate Packer variables
bobsira Sep 10, 2026
c1aa594
Address PR feedback and preserve failed build diagnostics
bobsira Sep 11, 2026
c369c8f
Make Windows image builds unattended and isolate build publication
bobsira Sep 12, 2026
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
153 changes: 59 additions & 94 deletions .github/workflows/build-windows-vhd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,24 @@ on:
workflow_dispatch:
inputs:
kubernetes_version:
description: 'Kubernetes version (optional, leave blank for latest)'
description: 'Kubernetes version (optional, leave blank to use var-file)'
required: false
default: ''
windows_version:
description: 'Windows version (optional, leave blank for latest)'
description: 'Windows version (optional, leave blank to use var-file)'
required: false
default: ''
containerd_version:
description: 'Containerd version (optional, leave blank to use var-file)'
required: false
default: ''

permissions:
contents: read

concurrency:
group: windows-node-image-builder
cancel-in-progress: false

jobs:
build-upload-vhd:
Expand All @@ -24,114 +35,68 @@ jobs:
- windows
- hyperv

env:
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }}
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }}
AZURE_CONTAINER_NAME: ${{ secrets.AZURE_STORAGE_CONTAINER }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Display runner info
shell: pwsh
shell: powershell
run: |
Write-Host "Runner OS: $env:RUNNER_OS"
Write-Host "Runner Labels: $env:RUNNER_LABELS"
Write-Host "PowerShell Ed.: $($PSVersionTable.PSEdition) $($PSVersionTable.PSVersion)"

- name: Ensure Hyper-V is enabled
shell: pwsh
- name: Ensure Packer and Azure CLI are installed
shell: powershell
run: |
Start-Process pwsh -Verb RunAs -ArgumentList '-NoProfile -Command {
Write-Host "Checking Hyper-V feature..."
$hv = Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All
if ($hv.State -ne "Enabled") {
throw "Hyper-V is not enabled on this host!"
}
Write-Host "Hyper-V is enabled."
}' -Wait

- name: Grant Hyper-V Administrators group membership
shell: pwsh
run: |
$runnerUser = (whoami).Trim()
Write-Host "Adding '$runnerUser' to Hyper-V Administrators group..."
# Add-LocalGroupMember -Group "Hyper-V Administrators" -Member $runnerUser -ErrorAction Stop
Write-Host "Current Hyper-V Administrators members:"
Get-LocalGroupMember -Group "Hyper-V Administrators" | ForEach-Object { Write-Host $_.Name }

- name: Install Chocolatey, Packer & Azure CLI
shell: pwsh
run: |
Start-Process pwsh -Verb RunAs -ArgumentList '-NoProfile -Command {
Write-Host "Checking and installing dependencies…"

if (-not (Get-Command choco -ErrorAction SilentlyContinue)) {
Write-Host "Installing Chocolatey…"
Set-ExecutionPolicy Bypass -Scope Process -Force
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-Expression ((New-Object Net.WebClient).DownloadString("https://community.chocolatey.org/install.ps1"))
} else {
Write-Host "Chocolatey already present."
}

if (-not (Get-Command packer -ErrorAction SilentlyContinue)) {
Write-Host "Installing Packer…"
choco install packer -y
} else {
Write-Host "Packer already present."
$ErrorActionPreference = 'Stop'
foreach ($tool in @(
@{ Command = 'packer'; Package = 'packer' },
@{ Command = 'az'; Package = 'azure-cli' }
)) {
if (-not (Get-Command $tool.Command -ErrorAction SilentlyContinue)) {
if (-not (Get-Command choco -ErrorAction SilentlyContinue)) {
throw "Install Chocolatey or preinstall $($tool.Command) on this runner."
}
choco install $tool.Package -y --no-progress
if ($LASTEXITCODE -ne 0) {
throw "Installing $($tool.Package) failed with exit code $LASTEXITCODE."
}
$env:PATH = [Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' +
[Environment]::GetEnvironmentVariable('PATH', 'User')
Get-Command $tool.Command -ErrorAction Stop | Out-Null
}

if (-not (Get-Command az -ErrorAction SilentlyContinue)) {
Write-Host "Installing Azure CLI…"
choco install azure-cli -y
} else {
Write-Host "Azure CLI already present."
}
}' -Wait

- name: Initialize & Validate Packer
shell: pwsh
run: |
Write-Host "Initializing Packer…"
packer init windows.json.pkr.hcl

Write-Host "Formatting…"
packer fmt -var-file='windows.auto.pkrvars.hcl' windows.json.pkr.hcl

Write-Host "Validating…"
packer validate -var-file='windows.auto.pkrvars.hcl' windows.json.pkr.hcl
}

- name: Build VHD with Packer
shell: pwsh
id: build
shell: powershell
env:
KUBERNETES_VERSION: ${{ inputs.kubernetes_version || '' }}
WINDOWS_VERSION: ${{ inputs.windows_version || '' }}
CONTAINERD_VERSION: ${{ inputs.containerd_version || '' }}
run: |
Write-Host "Starting Packer build…"
packer build -force -var-file='windows.auto.pkrvars.hcl' windows.json.pkr.hcl

- name: Locate generated VHD
shell: pwsh
run: |
Write-Host "Searching for VHD in output directories..."
$vhd = Get-ChildItem -Path "./output*", "./output-*", "./output" -Include "*.vhd", "*.vhdx" -Recurse | Select-Object -First 1
if (-not $vhd) {
throw "No VHD file found in output directory!"
}
Write-Host "Found VHD: $($vhd.FullName)"
echo "VHD_PATH=$($vhd.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Append

- name: Upload VHD to Azure Blob Storage
shell: pwsh
$ErrorActionPreference = 'Stop'
.\scripts\Build-WindowsImage.ps1 `
-WindowsVersion $env:WINDOWS_VERSION `
-KubernetesVersion $env:KUBERNETES_VERSION `
-ContainerdVersion $env:CONTAINERD_VERSION

- name: Publish canonical disk to Azure Blob Storage
shell: powershell
env:
BUILD_RESULT_PATH: ${{ steps.build.outputs.result_path }}
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }}
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }}
AZURE_CONTAINER_NAME: ${{ secrets.AZURE_STORAGE_CONTAINER }}
run: |
Write-Host "Uploading $env:VHD_PATH to blob container '$env:AZURE_CONTAINER_NAME'…"
az storage blob upload `
--account-name $env:AZURE_STORAGE_ACCOUNT `
--account-key $env:AZURE_STORAGE_KEY `
--container-name $env:AZURE_CONTAINER_NAME `
--file $env:VHD_PATH `
--name (Split-Path $env:VHD_PATH -Leaf) `
--overwrite
Write-Host "Upload complete."
$ErrorActionPreference = 'Stop'
.\scripts\Publish-WindowsImage.ps1 -ResultPath $env:BUILD_RESULT_PATH

- name: Upload build and publication logs
if: always() && steps.build.outputs.log_directory != ''
uses: actions/upload-artifact@v4
with:
name: packer-log-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ steps.build.outputs.log_directory }}
if-no-files-found: warn
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packer_cache/
build-logs/
build-artifacts/
Loading
Loading