Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions apps/cli-docs/src/content/docs/migrating-from-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ sentry-cli() {
esac
done
set -- "${remaining[@]}"
[ "${SENTRY_ALLOW_FAILURE:-}" = "1" ] && allow_failure=1
# Same values v3 accepted for SENTRY_ALLOW_FAILURE.
case "${SENTRY_ALLOW_FAILURE:-}" in 1|true) allow_failure=1 ;; esac
[ -n "$headers" ] && envs+=("SENTRY_CUSTOM_HEADERS=$headers")

# `env` runs the real `sentry` (bypassing this function → no recursion),
Expand Down Expand Up @@ -383,10 +384,14 @@ credentials as it did in v3.
- `--quiet` (and its `--silent` alias) has no direct replacement — pipe the
output (non-TTY is plain) or use `--log-level error`.
- `--allow-failure` (and the `SENTRY_ALLOW_FAILURE` env var), which made any
command exit `0` even on error, is **not implemented in v4** and will be
rejected as an unknown flag. Handle failures in your own script (e.g.
`sentry … || true`); the [shim](#drop-in-compatibility-shim) above emulates
the old behavior when it sees the flag or env var.
command exit `0` even on error, is **not implemented in v4**. `sentry`
rejects the flag as unknown and ignores the env var. To keep optional CI
steps from failing the build, either:
- call `sentry-cli` through the [shim](#drop-in-compatibility-shim) above. It
strips `--allow-failure` wherever it appears and honors
`SENTRY_ALLOW_FAILURE=1` (or `true`, as in v3): the error is still printed,
but the call returns `0`.
- or handle the failure yourself, e.g. `sentry sourcemap upload ./dist || true`.
- `SENTRY_API_KEY` (the v3 `apiKey` option) and `SENTRY_VCS_REMOTE` (the
`vcsRemote` option) are no longer honored — use `SENTRY_AUTH_TOKEN` for auth.
- `SENTRY_CUSTOM_HEADERS` only applies to self-hosted Sentry; custom headers are
Expand Down
19 changes: 19 additions & 0 deletions apps/cli-docs/test/migration-shim.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@ test("translates trailing auth and headers and honors allow-failure", () => {
]);
});

for (const value of ["1", "true"]) {
test(`SENTRY_ALLOW_FAILURE=${value} turns a failure into exit 0`, () => {
const result = runShim(["releases", "new", "1.0.0"], {
SENTRY_ALLOW_FAILURE: value,
SENTRY_TEST_SHIM_EXIT: "23",
});
assert.equal(result.status, 0, result.stderr);
assert.match(result.stderr, /exiting 0/);
});
}

test("other SENTRY_ALLOW_FAILURE values keep the exit status", () => {
const result = runShim(["releases", "new", "1.0.0"], {
SENTRY_ALLOW_FAILURE: "0",
SENTRY_TEST_SHIM_EXIT: "23",
});
assert.equal(result.status, 23, result.stderr);
});

test("translates trailing host URL but preserves release URL", () => {
const issue = runShim(["issues", "--url", "https://sentry.example.com", "list"], { SENTRY_TEST_SHIM_ENV: "1" });
assert.equal(issue.status, 0, issue.stderr);
Expand Down
Loading