Skip to content
Open
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
86 changes: 57 additions & 29 deletions .github/workflows/cli-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ jobs:
os: ubuntu-latest
- target: linux-arm64
os: ubuntu-latest
- target: linux-x64-musl
os: ubuntu-latest
- target: windows-arm64
os: ubuntu-latest
- target: windows-x64
os: ubuntu-latest
steps:
Expand Down Expand Up @@ -126,18 +130,9 @@ jobs:
SENTRY_AUTH_TOKEN: ""
SENTRY_TOKEN: ""
SENTRY_CONFIG_DIR: ${{ runner.temp }}/.sentry-smoke
NIGHTLY_VERSION: ${{ needs.nightly-version.outputs.version }}
TARGET: ${{ matrix.target }}
shell: bash
run: |
binary="packages/cli/dist-bin/sentry-${TARGET}"
"$binary" --help
if [[ "$GITHUB_REF" == 'refs/heads/main' ]]; then
test "$("$binary" --version)" = "$NIGHTLY_VERSION"
fi
output=$("$binary" auth status 2>&1) && status=$? || status=$?
test "$status" -eq 10
printf '%s\n' "$output" | grep -qi 'not authenticated'
EXPECTED_VERSION: ${{ github.ref == 'refs/heads/main' && needs.nightly-version.outputs.version || '' }}
BINARY: packages/cli/dist-bin/sentry-${{ matrix.target }}
run: node scripts/cli-binary-smoke.mjs
- name: Verify code signature (darwin)
if: matrix.target == 'darwin-arm64' && github.event_name == 'push'
shell: bash
Expand All @@ -155,6 +150,49 @@ jobs:
name: sentry-${{ matrix.target }}-gz
path: packages/cli/dist-bin/*.gz

# The build job smoke-tests only binaries its runner can run. This job runs
# the cross-compiled musl and Windows arm64 binaries on their own platform.
smoke-binary:
name: Smoke Test Binary (${{ matrix.target }})
needs: [nightly-version, build-binary]
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- target: linux-x64-musl
binary: sentry-linux-x64-musl
os: ubuntu-latest
container: alpine:3.24@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf
- target: windows-arm64
binary: sentry-windows-arm64.exe
os: windows-11-arm
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
# Alpine has none of the binary's C++ runtime libraries. Add the ones the
# installer asks for, and Node.js for the smoke test script. The
# windows-11-arm image comes with Node.js.
- name: Install Alpine packages
if: matrix.target == 'linux-x64-musl'
run: apk add --no-cache libstdc++ libatomic nodejs
- name: Download binary artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: sentry-${{ matrix.target }}
path: dist-bin
Comment thread
sentry-junior[bot] marked this conversation as resolved.
Resolved
- name: Smoke test
env:
SENTRY_AUTH_TOKEN: ""
SENTRY_TOKEN: ""
SENTRY_CONFIG_DIR: ${{ runner.temp }}/.sentry-smoke
EXPECTED_VERSION: ${{ github.ref == 'refs/heads/main' && needs.nightly-version.outputs.version || '' }}
BINARY: dist-bin/${{ matrix.binary }}
run: node scripts/cli-binary-smoke.mjs

generate-patches:
name: Generate nightly delta patches
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
Expand Down Expand Up @@ -198,14 +236,18 @@ jobs:
if: >-
always() && github.ref == 'refs/heads/main' && github.event_name == 'push' &&
needs.nightly-version.result == 'success' && needs.build-binary.result == 'success' &&
needs.smoke-binary.result == 'success' &&
(needs.generate-patches.result == 'success' || needs.generate-patches.result == 'failure')
needs: [nightly-version, build-binary, generate-patches]
needs: [nightly-version, build-binary, smoke-binary, generate-patches]
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
- name: Download compressed binaries
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
Expand Down Expand Up @@ -240,22 +282,8 @@ jobs:
- name: Verify public nightly and immutable version tag
env:
NIGHTLY_VERSION: ${{ needs.nightly-version.outputs.version }}
shell: bash
run: |
set -euo pipefail
token=$(curl -fsS 'https://ghcr.io/token?scope=repository:getsentry/toolkit:pull' | jq -er '.token')
for tag in nightly "nightly-${NIGHTLY_VERSION}"; do
manifest=$(curl -fsS \
-H "Authorization: Bearer ${token}" \
-H 'Accept: application/vnd.oci.image.manifest.v1+json' \
"https://ghcr.io/v2/getsentry/toolkit/manifests/${tag}")
jq -e --arg version "$NIGHTLY_VERSION" '
.annotations.version == $version and
.annotations["org.opencontainers.image.source"] == "https://github.com/getsentry/toolkit" and
([.layers[].annotations["org.opencontainers.image.title"]] | sort) ==
(["sentry-darwin-arm64.gz", "sentry-darwin-x64.gz", "sentry-linux-arm64.gz", "sentry-linux-x64.gz", "sentry-windows-x64.exe.gz"] | sort)
' <<< "$manifest" > /dev/null
done
ARTIFACTS_DIR: artifacts
run: node scripts/cli-nightly-verify.mjs

build-npm:
name: Build npm Package
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/install-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ jobs:
sentry --version

# glibc distros with the musl package installed have the musl loader, which
# the installer once took as proof of musl. Alpine must still be refused.
# the installer once took as proof of musl. Alpine must get the musl build,
# and only once its C++ runtime libraries are installed.
linux-libc:
name: bash detects ${{ matrix.libc }} on ${{ matrix.image }}
runs-on: ubuntu-latest
Expand Down
18 changes: 13 additions & 5 deletions apps/cli-docs/src/content/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,30 @@ It installs stable releases only. To switch to nightly afterwards, run
<td></td>
</tr>
<tr>
<td><strong>Linux</strong></td>
<td><strong>Linux (glibc)</strong></td>
<td>x64, arm64</td>
<td>Standalone binary requires glibc</td>
<td>Debian, Ubuntu, Fedora, Arch, and most others</td>
</tr>
<tr>
<td><strong>Windows</strong></td>
<td><strong>Linux (musl)</strong></td>
<td>x64</td>
<td>Alpine: run <code>apk add libstdc++ libatomic</code> first</td>
</tr>
<tr>
<td><strong>Windows</strong></td>
<td>x64, arm64</td>
<td>Via PowerShell, Git Bash, MSYS2, or WSL</td>
</tr>
</tbody>
</table>

{/* GENERATED:END platform-support */}

On Alpine and other musl-based Linux systems, install Node.js and use
`npm install -g sentry` instead of the standalone installer.
The standalone binary embeds Node.js, so it exists only for platforms that
Node.js publishes official builds for. On any other platform, such as musl on
arm64 or 32-bit systems, the installers stop and point you to the npm package:
install Node.js 20 or later and run `npm install -g sentry`, or use another
[package manager](#package-managers).

## Homebrew

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"scripts": {
"docs:check": "node scripts/check-doc-links.mjs",
"test:ci-projects": "node --test scripts/ci-projects.test.mjs scripts/check-workspace-deps.test.mjs scripts/cli-nightly-version.test.mjs scripts/cli-nightly-watchdog.test.mjs scripts/platform-setup-pr.test.mjs scripts/codemod-version-changed.test.mjs scripts/npm-library-workspaces.test.mjs scripts/cloudflare-deployment.test.mjs scripts/deploy-workflow.test.mjs scripts/migrate-cloudflare-token.test.mjs scripts/oxc-config.test.mjs scripts/cli-lint-rules.test.mjs scripts/workflow-policy.test.mjs scripts/tsconfig-policy.test.mjs",
"test:ci-projects": "node --test scripts/ci-projects.test.mjs scripts/check-workspace-deps.test.mjs scripts/cli-binary-smoke.test.mjs scripts/cli-nightly-version.test.mjs scripts/cli-nightly-verify.test.mjs scripts/cli-nightly-watchdog.test.mjs scripts/platform-setup-pr.test.mjs scripts/codemod-version-changed.test.mjs scripts/npm-library-workspaces.test.mjs scripts/cloudflare-deployment.test.mjs scripts/deploy-workflow.test.mjs scripts/migrate-cloudflare-token.test.mjs scripts/oxc-config.test.mjs scripts/cli-lint-rules.test.mjs scripts/workflow-policy.test.mjs scripts/tsconfig-policy.test.mjs",
"dev": "pnpm --filter '@sentry/mcp-cloudflare...' --if-present run build && dotenv -e .env -e .env.local -- pnpm --parallel --filter @sentry/mcp-cloudflare --filter @sentry/mcp-core --filter @sentry/mcp-server-mocks --if-present run dev",
"dev:stdio": "pnpm --filter '@sentry/mcp-core...' --if-present run build 1>&2 && dotenv -e .env -e .env.local -- pnpm --silent --dir packages/cli run cli mcp",
"build": "dotenv -e .env -e .env.local -- pnpm -r --filter '!sentry' --filter '!sentry-cli-docs' --if-present run build",
Expand Down
41 changes: 30 additions & 11 deletions packages/cli/install
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ GHCR_REPO="ghcr.io/v2/getsentry/toolkit"
# --retry-all-errors (7.71).
curl_retry=(--retry 3 --retry-connrefused --retry-max-time 60)

# Where there is no standalone binary, the npm package runs on Node.js.
npm_fallback="Install Node.js 20 or later and run: npm install -g sentry"

no_room_message="There is not enough room to download sentry (about 140 MB) into the install directory, or it is not writable. Free up space or set SENTRY_INSTALL_DIR to another directory, then retry."

# Installer state. The steps below fill these in; error reports read them.
Expand All @@ -48,9 +51,9 @@ no_completions=false
no_agent_skills=false
os="" # darwin, linux, or windows
arch="" # x64 or arm64
libc_variant="" # set to musl only to report why the install stopped
libc_variant="" # "musl" on musl-based Linux, such as Alpine
suffix="" # ".exe" on Windows
asset="" # release file name, such as sentry-linux-x64
asset="" # release file name, such as sentry-linux-x64-musl
version="" # the exact version being installed
gz_url="" # release downloads and their SHA-256 checksums
gz_sha=""
Expand Down Expand Up @@ -227,29 +230,45 @@ detect_platform() {
Darwin*) os="darwin" ;;
Linux*) os="linux" ;;
MINGW*|MSYS*|CYGWIN*) os="windows" ;;
*) die "Unsupported OS: $(uname -s)" "detect-os" ;;
*) die "Unsupported OS: $(uname -s). ${npm_fallback}" "detect-os" ;;
esac

arch=$(uname -m)
case "$arch" in
x86_64) arch="x64" ;;
aarch64|arm64) arch="arm64" ;;
*) die "Unsupported architecture: $arch" "detect-arch" ;;
*) die "Unsupported architecture: $arch. ${npm_fallback}" "detect-arch" ;;
esac

# The standalone binary is a Node.js SEA, and official Node.js builds
# target glibc.
# The standalone binary is a Node.js SEA, so it exists only where Node.js
# publishes an official build. Its only musl build is for x64.
if [[ "$os" == "linux" ]] && is_musl; then
libc_variant="musl"
die "The standalone binary requires glibc. On musl (Alpine), install Node.js and run: npm install -g sentry" "detect-libc"
[[ "$arch" == "x64" ]] \
|| die "Unsupported: linux-${arch}-musl (the musl binary is x64 only). ${npm_fallback}" "detect-libc"
require_musl_libraries
fi

if [[ "$os" == "windows" ]]; then
suffix=".exe"
[[ "$arch" == "x64" ]] || die "Unsupported: windows-$arch (only windows-x64 is supported)" "detect-arch"
fi

asset="sentry-${os}-${arch}${suffix}"
asset="sentry-${os}-${arch}${libc_variant:+-${libc_variant}}${suffix}"
}

# The musl build of Node.js links against libstdc++, libgcc, and libatomic,
# which Alpine does not install by default. Stop before the download when one
# is missing.
require_musl_libraries() {
local lib missing=()
for lib in libstdc++.so.6 libgcc_s.so.1 libatomic.so.1; do
if [[ ! -e "/lib/${lib}" && ! -e "/usr/lib/${lib}" && ! -e "/usr/local/lib/${lib}" ]]; then
missing+=("$lib")
fi
done
if (( ${#missing[@]} > 0 )); then
die "The musl binary needs ${missing[*]}. On Alpine, run: apk add libstdc++ libatomic, then retry. Or: ${npm_fallback}" "detect-libc-deps"
fi
}

# Succeeds on musl-based Linux, such as Alpine.
Expand Down Expand Up @@ -502,7 +521,7 @@ fetch_registry_release() {
{ read -r gz_url; read -r gz_sha; } <<< "$(registry_file "$metadata" "${asset}.gz")" || true
{ read -r raw_url; read -r raw_sha; } <<< "$(registry_file "$metadata" "$asset")" || true
if [[ -z "$gz_url" && -z "$raw_url" ]]; then
die "Sentry CLI ${version} has no ${asset} build" "resolve-asset"
die "Sentry CLI ${version} has no ${asset} build. ${npm_fallback}" "resolve-asset"
fi
}

Expand Down Expand Up @@ -584,7 +603,7 @@ download_nightly() {
muted "Installing nightly sentry ${version}..."

digest=$(layer_digest "${asset}.gz" <<< "$manifest")
[[ -n "$digest" ]] || die "No nightly build found for ${asset}.gz" "ghcr-digest"
[[ -n "$digest" ]] || die "No nightly build found for ${asset}.gz. ${npm_fallback}" "ghcr-digest"

download_nightly_blob "$token" "$digest"
unpack_binary "$blob_file"
Expand Down
21 changes: 14 additions & 7 deletions packages/cli/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ function Install-SentryCli {
Write-Verbose "Could not enable TLS 1.2: $_"
}

$asset = 'sentry-windows-x64.exe'
# Where there is no standalone binary, the npm package runs on Node.js.
$npmFallback = 'Install Node.js 20 or later and run: npm install -g sentry'
# What error reports say about the install. Each step updates it.
$state = @{ Step = 'start'; Version = 'unknown'; Arch = 'unknown' }

function Invoke-Install {
Assert-WindowsX64
# The functions below read $asset from this scope.
$asset = Get-WindowsAsset
$release = Resolve-Release
$binary = Save-Binary $release
try {
Expand All @@ -62,7 +64,8 @@ function Install-SentryCli {
# Step 1: check that this machine can run the binary
# -------------------------------------------------------------------------

function Assert-WindowsX64 {
# Returns the release file name for this machine's architecture.
function Get-WindowsAsset {
$state.Step = 'detect-os'
if ($env:OS -ne 'Windows_NT') {
Stop-Install 'This installer is for Windows. On macOS and Linux, run: curl https://cli.sentry.dev/install -fsS | bash'
Expand All @@ -73,10 +76,14 @@ function Install-SentryCli {
# PROCESSOR_ARCHITEW6432 to the real architecture.
$arch = if ($env:PROCESSOR_ARCHITEW6432) { $env:PROCESSOR_ARCHITEW6432 } else { $env:PROCESSOR_ARCHITECTURE }
$state.Arch = "$arch"
if ($arch -ne 'AMD64') {
Stop-Install "Unsupported: windows-$arch (only windows-x64 is supported). Install Node.js and run: npm install -g sentry"
switch ($arch) {
'AMD64' { $state.Arch = 'x64' }
'ARM64' { $state.Arch = 'arm64' }
default {
Stop-Install "Unsupported: windows-$arch (only x64 and arm64 are supported). $npmFallback"
}
}
$state.Arch = 'x64'
return "sentry-windows-$($state.Arch).exe"
}

# -------------------------------------------------------------------------
Expand Down Expand Up @@ -115,7 +122,7 @@ function Install-SentryCli {
}
$state.Version = $release.Version
if ($null -eq $release.Gz -and $null -eq $release.Raw) {
Stop-Install "Sentry CLI $($release.Version) has no $asset build"
Stop-Install "Sentry CLI $($release.Version) has no $asset build. $npmFallback"
}
return $release
}
Expand Down
Loading
Loading