Repository navigation
feat(cli): Fail clearly when v3 scripts call sentry-cli - #2929
Conversation
v4 installs only `sentry`, so scripts written for v3 that call `sentry-cli` exit 127 with "command not found", or, when they saved the v4 binary as `sentry-cli`, run v4 commands they were not written for. Both now print that the command is now `sentry`, link the migration guide, list the v3 pins, and exit 1. Neither runs `sentry`. - The binary checks the name it runs as (argv0 or its own file name): `sentry-cli` or `sentry-cli.exe` gets the message. As `sentry`, nothing changes, hidden v3 aliases included. - PyPI `sentry-cli`: a `sentry-cli` console script, so pip writes a launcher on every platform. npm `@sentry/cli` is left as is: a second bin would make `npx @sentry/cli` fail with "could not determine executable to run". The message and exit code live in src/lib/sentry-cli-rename.ts. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
The v4 binary run as sentry-cli and the PyPI sentry-cli command print a rename notice with the v3 pins and exit 1 (#2929). Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
BYK
left a comment
There was a problem hiding this comment.
Make sure this is compatible with our v3 shim published as part of our migration guide
Checked against the migration guide on main. The full I tested the built binary with a copy named via @BYK. |
…er (getsentry#2930) The get-cli installer (`curl https://cli.sentry.dev/install | sh`) puts only `sentry` on PATH, so v3 scripts that call `sentry-cli` fail with "command not found". The installer now also writes a POSIX sh `sentry-cli` next to `sentry`. It prints the same message as getsentry#2929 (the v4 binary run as `sentry-cli`, and PyPI's `sentry-cli`) and exits 1. It never runs `sentry`. Before: ``` $ sentry-cli --version sh: 1: sentry-cli: not found # exit 127 ``` After: ``` $ sentry-cli --version Error: sentry-cli is now sentry. Sentry CLI v4 renamed the command and changed some commands and flags. Update your scripts: https://cli.sentry.dev/migrating-from-v3/ Or stay on v3: npm: npm install @sentry/cli@3 pip: pip install "sentry-cli<4" get-cli: curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=3.8.2 sh # exit 1 ``` - When another `sentry-cli` is on PATH or already in the install directory, the installer leaves it alone, so a real v3 install stays. A marker line lets a later install replace its own copy. - On glibc older than 2.28, `install_v3` replaces the script before setup runs, so the real `sentry-cli` 3.8.2 is never overwritten. - The migration guide's `sentry-cli` function and alias still take priority over the file on PATH. - `sentry cli uninstall` does not remove the shim yet. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Af43004685b81a1275821d14a033373dd --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Af43004685b81a1275821d14a033373dd) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Af43004685b81a1275821d14a033373dd/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <126780+BYK@users.noreply.github.com>
…ers (getsentry#2928) **Do not merge until `getsentry/sentry-cli:3` exists on Docker Hub.** The doc points v3 users at that tag, which doesn't exist yet. Homebrew 6 and later don't follow the `sentry-cli` → `sentry` formula rename in getsentry/tools under [tap trust](https://docs.brew.sh/Tap-Trust). The migration guide said `brew update` moves installs to v4 and `brew pin sentry-cli` keeps v3, which isn't what happens now: ``` # before $ brew install getsentry/tools/sentry-cli Error: Refusing to load formula getsentry/tools/sentry from untrusted tap getsentry/tools. $ brew upgrade # existing sentry-cli install: skipped, stays on 3.8.2 # after (documented) $ brew install getsentry/tools/sentry # v4, trusts the formula itself $ brew install --cask sentry-cli # stay on v3 (homebrew/cask, 3.8.2) ``` The Docker section now points v3 users at `getsentry/sentry-cli:3` and shows v4 replacements for the two patterns that broke when `latest` moved to the distroless image: ```dockerfile # before COPY --from=getsentry/sentry-cli /bin/sentry-cli /usr/local/bin/sentry-cli # after COPY --from=getsentry/sentry-cli:3 /bin/sentry-cli /usr/local/bin/sentry-cli # v3 COPY --from=getsentry/sentry-cli /usr/local/bin/sentry /usr/local/bin/sentry # v4 ``` GitLab CI jobs that use the image get a v3 (`:3`) and a v4 (`npx sentry@4` in a `node` image) example, since v4 has no shell. The "Where v3 was published" section also says what `sentry-cli` does since getsentry#2929: the v4 binary run as `sentry-cli` and PyPI's `sentry-cli` command print that the command is now `sentry`, link the guide and the v3 pins, and exit 1. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A8c3e19f8033286bd7749ab5fefed43cf --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A8c3e19f8033286bd7749ab5fefed43cf) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A8c3e19f8033286bd7749ab5fefed43cf/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <126780+BYK@users.noreply.github.com>
v4 installs only
sentry. A v3 script that callssentry-cligets "command not found". If the script saved a v4 binary assentry-cli, it runs v4 commands it wasn't written for. Both cases now fail the same way: a message that says what changed, then exit code 1. It never runssentry.Before:
After:
bin.tsshows the message when the process runs assentry-cliorsentry-cli.exe. It checksargv0(the name the binary was invoked as, which keeps a symlink's name) and the binary's own file name. Run assentry, nothing changes, and the hidden v3 aliases still work. The npm package runs undernode, so the check never fires there.sentry-cli: the wheels add asentry-cliconsole script. pip writes a launcher for it on every platform,sentry-cli.exeon Windows.@sentry/cliis left out on purpose. A second bin would breaknpx @sentry/cli …(npm: "could not determine executable to run") andpnpm dlx @sentry/cli …, which run v4sentrytoday.install) comes in a follow-up, after fix(cli): Install v3 on old glibc and make the installer POSIX sh #2927.The message and exit code live in
src/lib/sentry-cli-rename.ts.via @BYK.
--
View Session [Sentry]