VHD pipeline automation + containerd 2.x CNI fix - #6
Merged
Merged
Conversation
…VERSION env vars for Packer build
…sira/windows-node-image-builder into user/vhd_pipeline_automation
Owner
Author
There was a problem hiding this comment.
Pull request overview
This PR updates the Windows node image build system to support automated VHD creation/upload via GitHub Actions and to accommodate containerd 2.x configuration changes (specifically CNI path keys/format), alongside version parameterization through Packer vars/env.
Changes:
- Adds a GitHub Actions workflow to build a Windows VHD on a self-hosted Hyper-V runner and upload it to Azure Blob Storage.
- Updates the Packer template/vars to explicitly parameterize Windows/Kubernetes/containerd versions and adjusts provisioning steps.
- Improves WinRM enablement scripting and updates containerd CNI config patching logic for containerd 2.x.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
windows.json.pkr.hcl |
Adds version variables and updates provisioning flow (containers feature install/restarts, passes containerd version into VM config). |
windows.auto.pkrvars.hcl |
Updates default Kubernetes/containerd versions and cleans up/organizes ISO URL/checksum inputs. |
setup/enable-winrm.ps1 |
Reworks WinRM setup for better logging/idempotence and adds network profile readiness wait + sanity checks. |
setup/configure-vm.ps1 |
Makes Kubernetes/containerd version selection explicit and patches containerd config parsing for 1.x vs 2.x CNI key formats. |
setup/Autounattend.xml |
Updates first-logon commands (more robust WinRM script discovery; removes containers install from unattend). |
.github/workflows/build-windows-vhd.yml |
Adds/updates CI automation for building VHDs and uploading artifacts/logs and final VHD to Azure. |
Comments suppressed due to low confidence (1)
windows.json.pkr.hcl:66
win_iso_checksums,win_iso_urls,windows_version, andkubernetes_versionare declared twice. Packer/HCL will fail to load the template due to duplicate variable blocks.
variable "win_iso_checksums" {
type = map(string)
default = {}
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fix Packer override arguments, validate CNI configuration keys, preserve original WinRM setup errors, and clarify workflow documentation. Always upload available Packer logs and retain failed provisioning VMs for inspection.
Add unique build identities, shared host locking, isolated outputs and logs, and immediate DVD boot retries. Publish the canonical disk under a renewable Azure lease and provide a single-command test runner.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
configure-vm.ps1which caused Windows nodes to stayNotReadyafter upgrading to containerd 2.xRoot cause of CNI fix
containerd 2.x changed the default
config.tomlformat: the CNI bin directory key was renamed frombin_dirtobin_dirs(array syntax) and values changed from double-quoted to single-quoted strings. The provisioning script was doing exact string matching against the 1.x format, so neither replacement ever fired — leaving containerd pointing at non-existent default paths and causingcni plugin not initializederrors on Windows nodes.The fix uses version-aware regex patterns, branching on the major version of
$containerd_verto apply the correct format for 1.x or 2.x. Both branches fail loudly if expected keys are not found.Test plan
Readystate