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
20 changes: 19 additions & 1 deletion docs/cli/snapshots.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,23 @@ If you only upload a subset of your snapshots per CI run — for example, becaus
sentry-cli snapshots upload ./snapshots --app-id web-frontend --selective
```

When an upload is marked as selective, Sentry only diffs the snapshots you uploaded. Any snapshot that exists in the base build but was not included in the upload is treated as unchanged rather than removed. Removals and renames cannot be detected when using `--selective`, because Sentry cannot distinguish a deliberately deleted snapshot from one that was not part of the subset.
When an upload is marked as selective, Sentry only diffs the snapshots you uploaded. Any snapshot that exists in the base build but was not included in the upload is treated as unchanged rather than removed. Removals and renames cannot be detected when using `--selective` alone, because Sentry cannot distinguish a deliberately deleted snapshot from one that was not part of the subset.

### Detecting Removals and Renames

Pass the full list of image names in your suite to enable removal and rename detection. Both flags implicitly enable `--selective`.

```bash
# comma-separated inline
sentry-cli snapshots upload ./snapshots \
--app-id web-frontend \
--all-image-file-names "homepage.png,settings/profile.png,settings/billing.png"

# or a file with one name per line
sentry-cli snapshots upload ./snapshots \
--app-id web-frontend \
--all-image-file-names-file all-snapshot-names.txt
```

## Diff Threshold

Expand All @@ -84,6 +100,8 @@ sentry-cli snapshots upload [OPTIONS] --app-id <APP_ID> <PATH>
| `-o`, `--org <ORG>` | Sentry organization slug. Can also be set via `SENTRY_ORG`. |
| `-p`, `--project <PROJECT>` | Sentry project slug. Can also be set via `SENTRY_PROJECT`. |
| `--selective` | Mark the upload as a subset. Use when uploading only a portion of your snapshots (for example, affected tests only). |
| `--all-image-file-names <NAMES>` | Comma-separated list of all image names (including subdirectory paths) in the full test suite. Used with selective uploads to detect removals and renames. Implicitly enables `--selective`. Mutually exclusive with `--all-image-file-names-file`. |
| `--all-image-file-names-file <PATH>` | Path to a file listing all image names (including subdirectory paths), one per line. Used with selective uploads to detect removals and renames. Implicitly enables `--selective`. Mutually exclusive with `--all-image-file-names`. |
| `--diff-threshold <THRESHOLD>` | Float between `0.0` and `1.0`. Sentry only reports images as changed if the percentage of changed pixels exceeds this value. |
| `--head-sha <SHA>` | Commit SHA for the upload. Auto-detected in CI. |
| `--base-sha <SHA>` | Base commit SHA for comparison (PR only). Auto-detected from merge-base. |
Expand Down
21 changes: 20 additions & 1 deletion docs/product/snapshots/uploading-snapshots/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,26 @@ When an upload is marked as selective, Sentry only diffs the snapshots you uploa
<Alert level="warning">
Because Sentry cannot distinguish a deliberately deleted snapshot from one
that was not part of the subset, removals and renames cannot be detected when
using `--selective`.
using `--selective` alone. Use `--all-image-file-names` or
`--all-image-file-names-file` to enable removal and rename detection.
</Alert>

### Detecting Removals and Renames

Pass the full list of image names in your suite to enable removal and rename detection. Both flags implicitly enable `--selective`.

```bash
# comma-separated inline
sentry-cli snapshots upload ./snapshots \
--app-id web-frontend \
--all-image-file-names "homepage.png,settings/profile.png,settings/billing.png"

# or a file with one name per line
sentry-cli snapshots upload ./snapshots \
--app-id web-frontend \
--all-image-file-names-file all-snapshot-names.txt
```

The CLI validates that every uploaded image appears in the provided list.

For the full `sentry-cli snapshots upload` flag reference, see [Snapshots (CLI)](/cli/snapshots/).
Loading