Repository navigation
refactor(cli): make the install scripts readable top to bottom - #2404
Open
sentry-junior[bot] wants to merge 4 commits into
Open
sentry-junior[bot] wants to merge 4 commits into
sentry-junior[bot] wants to merge 4 commits into
Conversation
Restructure both installers around a short happy path: bash main() and PowerShell Invoke-Install now read as the list of install steps, and each step is a small named helper with a comment saying what it does and why. Nested branches become guard clauses, repeated failure handling becomes one helper, and the bash script runs main on its last line so a truncated download executes nothing. Behavior, messages, telemetry steps, and setup arguments are unchanged. The only test change follows from the trap now naming main() as the function. Co-Authored-By: Evan Purkhiser <1421724+evanpurkhiser@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The bash installer now downloads into the directory `sentry cli setup` installs into, as setup's own temp file (sentry.download), instead of $TMPDIR with a fallback to that directory when the temp directory is full. Setup renames the download into place, a small or full /tmp no longer matters, and write_staged and the fallback paths go away. Co-Authored-By: Evan Purkhiser <1421724+evanpurkhiser@users.noreply.github.com>
When Sentry's release registry is down, an unpinned install now fails with "Failed to fetch latest stable version... install a specific version" instead of paging through GitHub releases for the newest stable cli@ tag. A pinned version still downloads from its GitHub release. This removes the GitHub API client, its rate-limit and token handling, and the release-page parsing from install, and Find-LatestToolkitVersion from install.ps1. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9b6cc85. Configure here.
This branch was successfully deployed
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.

Summary
Restructures
packages/cli/installandpackages/cli/install.ps1so that someone reading the installer before they pipe it to a shell can follow it. Today that means reading 700 lines of top-level code. Two behavior changes are listed below. Otherwise requests, messages, telemetrysteptags, setup arguments, and exit codes stay the same.Key Changes
main()and PowerShellInvoke-Installcome right after the header and list the install steps in order: parse args, detect the platform, resolve the release, download and verify, runsentry cli setup, then runsentry initif asked.require_downloadandrequire_good_checksum, and the duplicated JSONawkone-liners move intojson_field.main "$@"on its last line, so acurl | bashdownload that gets cut off runs nothing.Repair-DownloadandAssert-Sha256merge intoConfirm-Download. Gzip expansion moves intoExpand-Gzip. Download, setup, and init each get their own function.Behavior change: no GitHub fallback for
latest(both installers)When Sentry's release registry is down, an unpinned install now stops with "Failed to fetch latest stable version from Sentry's release registry. Retry or install a specific version". It no longer pages through GitHub releases to find the newest stable
cli@tag. A pinned version (--version/SENTRY_VERSION) still downloads from its GitHub release. This removes the GitHub API client, its token and rate-limit handling, and the release-page parsing from bash, plusFind-LatestToolkitVersionfrom PowerShell.Behavior change: bash downloads straight into the install directory
The bash installer used to download to
$TMPDIRand fall back to the install directory when the temp directory was full. Now it always downloads into the directorysentry cli setupinstalls into, as setup's own temp file (sentry.download). Setup renames it into place instead of copying it, and a small or full/tmpno longer matters. This removeswrite_stagedand the fallback paths.Side effects:
sentry.downloadcan be left behind. Normal exits and Ctrl-C clean it up.SENTRY_INSTALL_DIRinstead ofTMPDIR.Porting to POSIX
shis out of scope. The script depends on the bash ERR trap and$BASH_COMMANDreporting, arrays,nocasematch, andprintf -v.via @evanpurkhiser, @BYK.
--
View Session [Sentry]