Repository navigation
[infra] - Retry the PSScriptAnalyzer install on transient Gallery failures - #1733
Merged
Merged
Conversation
…lures The PSScriptAnalyzer job went red once on #1710 at Install-Module ("No match was found") before any script was analyzed; a re-run passed. The install now gets 3 attempts with a 10s/20s back-off and re-throws the last error, and the pinned-version check after it is unchanged, so the job still fails closed on a real problem. Refs #1709 item 9. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FZ8JTF2v1eQd1L5CKQR8j
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.
Proposed changes
#1709 item 9. The
PSScriptAnalyzer (powershell scripts)job in.github/workflows/script-lint.ymlfailed once on #1710 atInstall-Module PSScriptAnalyzer -RequiredVersion 1.23.0("No match was found"). That was before any script was analyzed, and a single re-run passed. The step had no retry, so any PowerShell Gallery hiccup turned an unrelated PR red.The install line is now wrapped in a 3-attempt loop:
-ErrorAction Stop;Nothing else changes:
1.23.0pin;Import-Moduleand version check after the install, which still fails closed;The worst case adds 30s to a job with a 10-minute timeout.
Option A from #1709. I chose it over caching (B): cache misses would still hit the Gallery, and a cache adds a key to keep in lockstep with the pin.
Invariant / Governance Impact: none. CI workflow only.
Types of changes
Scope: Infrastructure / CI only.
Benefits / why
Risks to monitor
WARNING: Install-Module attempt N/3 failed: …lines in the job log. If they show up often, consider caching (option B).Checklist
docs/THREAT_MODEL.md,INVARIANTS.mdandSECURITY.md(and any relevant Phase docs)Further comments
Run directly:
actionlint: clean.zizmor 1.28.0 --offline(the CI pin): no findings.The loop itself, extracted from the committed workflow and run under PowerShell 7.4.6 with
Install-ModuleandStart-Sleepstubbed:Not run here: CI uses Windows PowerShell 5.1 (
shell: powershell). The loop uses only constructs 5.1 supports (for,try/catch,Write-Warning,Start-Sleep), but this PR's ownPSScriptAnalyzerrun on Windows is the real check.Suggested merge order of open PRs
Trial merge verified: no other open PRs; branched from main @ c8ad99a on 2026-10-20.
This PR · Blocked (draft)
Impact: PSScriptAnalyzer install retry.
Action: independent, only open PR. Merge when CI is green.
ELI5
Before checking the PowerShell scripts, a CI job downloads a linter from the PowerShell Gallery. Once, the Gallery briefly said "not found", and the whole check failed even though nothing in the PR was wrong. Now the install step in
.github/workflows/script-lint.ymltries up to three times, waiting 10 and then 20 seconds between tries. If all three fail, it still fails with the real error. The rest of the job is untouched: same pinned version, same strict lint.I ran the retry logic itself under PowerShell 7 with a fake installer. Only Windows CI runs it under 5.1 with the real Gallery.
🤖 Generated with Claude Code
https://claude.ai/code/session_014FZ8JTF2v1eQd1L5CKQR8j
Last updated: 2026-10-20 10:20 ET
Generated by Claude Code