fix: harden Scoop install in deployment monitor - #7183
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This comment has been minimized.
This comment has been minimized.
|
another failure https://github.com/snyk/cli/actions/runs/33089662327 |
| 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" } |
There was a problem hiding this comment.
Question: Where does 1000 come from? Looks a bit hacky.
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Question: how come this is now required?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 👍
b95082b to
428b531
Compare
This comment has been minimized.
This comment has been minimized.
fea6276 to
e8acf43
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
e8acf43 to
f077a87
Compare
PR Reviewer Guide 🔍
|
Summary
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 callingscoop.scoop is not recognizedfailures whereInvoke-RestMethod | Invoke-Expressionsilently no-ops (~2s install with no output) and the step proceeds withoutscoopon PATH.Root cause analysis: GHA run 33067468112.
Test plan
workflow_dispatch, or wait for the scheduled rundeployment: Scoop (windows)completes with full installer output (~20–30s) and passes hash captureMade with Cursor