Skip to content

fix: harden Scoop install in deployment monitor - #7183

Open
robertolopezlopez wants to merge 1 commit into
mainfrom
fix/deployment-tests-scoop
Open

fix: harden Scoop install in deployment monitor#7183
robertolopezlopez wants to merge 1 commit into
mainfrom
fix/deployment-tests-scoop

Conversation

@robertolopezlopez

Copy link
Copy Markdown
Contributor

Summary

  • Harden the deployment: Scoop (windows) install step in Deployment Tests: download the Scoop installer to disk, reject truncated downloads, propagate the installer exit code, and refresh PATH before calling scoop.
  • Fixes intermittent scoop is not recognized failures where Invoke-RestMethod | Invoke-Expression silently no-ops (~2s install with no output) and the step proceeds without scoop on PATH.

Root cause analysis: GHA run 33067468112.

Test plan

  • Merge and trigger Deployment Tests via workflow_dispatch, or wait for the scheduled run
  • Confirm deployment: Scoop (windows) completes with full installer output (~20–30s) and passes hash capture

Made with Cursor

@robertolopezlopez
robertolopezlopez requested a review from a team as a code owner August 27, 2026 15:16
@snyk-io

snyk-io Bot commented Aug 27, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@snyk-pr-review-bot

This comment has been minimized.

@robertolopezlopez

Copy link
Copy Markdown
Contributor Author

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
Invoke-RestMethod -Uri https://get.scoop.sh -OutFile install-scoop.ps1
if ((Get-Item install-scoop.ps1).Length -lt 1000) { throw "Scoop installer download looks truncated" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Where does 1000 come from? Looks a bit hacky.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes get.scoop.sh returns error page instead of the installer

if ((Get-Item install-scoop.ps1).Length -lt 1000) { throw "Scoop installer download looks truncated" }
& ./install-scoop.ps1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$env:PATH = "$env:USERPROFILE\scoop\shims;$env:PATH"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: how come this is now required?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a safeguard. Possible to remove if you prefer. We do exactly the same in line 132 (capture version and shasum metadata step)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyway, I am now thinking that if installer fails (checked in line 125) we are already erroring out. And if the installer malfunctions with exit code 0 (unlikely), line 127 would fail (it is a failed test after all). I will remove this line 👍

@robertolopezlopez
robertolopezlopez force-pushed the fix/deployment-tests-scoop branch from b95082b to 428b531 Compare September 1, 2026 15:30
@snyk-pr-review-bot

This comment has been minimized.

@robertolopezlopez
robertolopezlopez force-pushed the fix/deployment-tests-scoop branch 2 times, most recently from fea6276 to e8acf43 Compare September 2, 2026 08:43
@snyk-pr-review-bot

This comment has been minimized.

@snyk-pr-review-bot

This comment has been minimized.

@robertolopezlopez
robertolopezlopez force-pushed the fix/deployment-tests-scoop branch from e8acf43 to f077a87 Compare September 2, 2026 09:31
@snyk-pr-review-bot

Copy link
Copy Markdown

PR Reviewer Guide 🔍

🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected
📚 Repository Context Analyzed

This review considered 5 relevant code sections from 5 files (average relevance: 0.71)

🤖 Repository instructions applied (from AGENTS.md)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants