From fa3bbedb5df360c3fcdbd0ed4cb91c5e6fae59b9 Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven <15776622+EwoutH@users.noreply.github.com> Date: Sat, 7 Nov 2026 13:08:09 +0100 Subject: [PATCH] Fix install.ps1 under `irm | iex`: drop [ValidateSet] on -Platform Invoke-Expression runs the script's param block as plain variable declarations, so the [ValidateSet] on -Platform was applied to the empty default and aborted the documented one-liner with "The attribute cannot be added because variable Platform with value would no longer be valid." Validate -Platform by hand after the param block instead. The nightly install smoke only ran the scriptblock form (which binds parameters normally), so add a Windows PowerShell 5.1 step that runs the literal `irm | iex` one-liner. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/nightly.yml | 16 ++++++++++++++++ install.ps1 | 6 +++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 9acc9401e8..d66377b1a0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -240,3 +240,19 @@ jobs: Write-Host "::error::install.ps1 installed a 0x$machine binary on this runner, expected 0x$env:PE_MACHINE" exit 1 } + + # The documented one-liner, which binds params differently from the + # scriptblock form above. It takes no flags, so it installs the + # latest stable release to the default location. + - name: install.ps1 via irm | iex (Windows PowerShell 5.1) + if: runner.os == 'Windows' + shell: powershell + run: | + irm "$env:RAW_BASE/install.ps1" | iex + $exe = Join-Path $env:USERPROFILE '.local\bin\q2.exe' + $raw = & $exe --version + Write-Host $raw + if ($LASTEXITCODE -ne 0 -or -not $raw) { + Write-Host "::error::q2.exe from the irm | iex install did not run" + exit 1 + } diff --git a/install.ps1 b/install.ps1 index 47c788b58d..d3cfb5bc6d 100644 --- a/install.ps1 +++ b/install.ps1 @@ -42,7 +42,7 @@ param( [string]$Checksum, [switch]$NoVerify, [switch]$Nightly, - [ValidateSet('windows_amd64', 'windows_arm64')] + # No [ValidateSet]: under `irm | iex` it rejects the empty default. [string]$Platform ) @@ -56,6 +56,10 @@ $UA = @{ 'User-Agent' = 'q2-install' } function Die([string]$msg) { throw "q2 install: $msg" } function Step([string]$msg) { Write-Host "-> $msg" } +if ($Platform -and $Platform -notin @('windows_amd64', 'windows_arm64')) { + Die "unknown -Platform '$Platform' (expected windows_amd64 or windows_arm64)" +} + if (-not [System.Environment]::Is64BitOperatingSystem) { Die 'only 64-bit Windows is supported' }