Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
8 changes: 7 additions & 1 deletion .github/workflows/powershell-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches: [ main ]
paths:
- 'helpers/software-report-base/**'
- 'images/windows/scripts/preflight/**'

jobs:
powershell-tests:
Expand All @@ -22,4 +23,9 @@ jobs:
run: |
$ErrorActionPreference = "Stop"
Invoke-Pester -Output Detailed "helpers/software-report-base/tests"


- name: Run Windows resolver preflight unit tests
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
Invoke-Pester -Output Detailed "images/windows/scripts/preflight/tests"
21 changes: 21 additions & 0 deletions docs/create-image-and-azure-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ After successful completion of all installation steps, Packer creates a managed
- [Azure Subscription Authentication](#azure-subscription-authentication)
- [Generated Machine Deployment](#generated-machine-deployment)
- [Automated image generation](#automated-image-generation)
- [Windows dependency preflight](#windows-dependency-preflight)
- [Required variables](#required-variables)
- [Optional variables](#optional-variables)
- [Builder variables](#builder-variables)
Expand Down Expand Up @@ -185,6 +186,26 @@ This function creates an Azure VM and generates network resources in Azure to ma

## Automated image generation

### Windows dependency preflight

Before starting a Windows Packer build, run the dependency-resolution preflight from the exact repository revision you plan to build. `-Image` is required so the template and toolset being validated always match the intended build:

```powershell
pwsh -File .\images\windows\scripts\preflight\Invoke-WindowsResolverPreflight.ps1 -Image Windows2025
```

Supported image values are `Windows2022`, `Windows2025`, `Windows2025VS2026`, `Windows11Arm64`, and `Windows11VS2026Arm64`.

The script uses `GITHUB_TOKEN` when it is available for GitHub release API queries. Set it in automated environments to avoid unauthenticated GitHub API rate limits; no token is required for a single ordinary run.

The preflight parses Windows PowerShell scripts, validates the selected image's local template references, and checks dependency metadata from the selected toolset, Chocolatey, PowerShell Gallery, GitHub releases, and Visual Studio Marketplace. It does not create Azure resources, provision a VM, download installer payloads, or mutate the build machine.

Use `-SkipNetwork` to run only the static checks:

```powershell
pwsh -File .\images\windows\scripts\preflight\Invoke-WindowsResolverPreflight.ps1 -Image Windows2025 -SkipNetwork
```

If you want to generate images automatically (e.g., as a part of a CI/CD pipeline),
you can use Packer directly. To do this, you will need:

Expand Down
Loading