Skip to content

feat(sourcemaps): Multi-project sourcemaps upload #2497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025

Conversation

szokeasaurusrex
Copy link
Member

It is now possible to upload sourcemaps to multiple projects at once, by passing the -p/--project flag multiple times to the sentry-cli sourcemaps upload command. Previously, it was possible to specify multiple projects via this flag, but all but the first project were ignored.

Multi-project sourcemaps uploads only work for Sentry servers which support chunked uploads – since this feature was added quite some time ago, we expect most self-hosted Sentry instances will support this. Older versions of Sentry continue to only support single-project uploads, but now, instead of silently ignoring all but the first project, an error is returned.

Closes #2408

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces multi‐project support for sourcemaps uploads by allowing repeated use of the –project flag on the CLI. Key changes include updating the UploadContext to use a projects slice, modifying API calls to accept multiple projects, and adjusting legacy upload and command modules to work with this new interface.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

File Description
src/utils/sourcemaps.rs Updated deduplication logic to extract a single project when applicable and ensure release is provided.
src/utils/file_upload.rs Replaced the single "project" with "projects" and updated legacy upload error handling.
src/api/mod.rs Updated API signatures and doc comments to accept slices for projects.
src/commands/* Adjusted command execution code to retrieve and pass multi‐project configuration.

Copy link
Contributor

@loewenheim loewenheim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except for some nits. Have you tested it?

@szokeasaurusrex szokeasaurusrex requested a review from loewenheim May 8, 2025 08:23
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/legacy-upload-context branch from e7dfc50 to 2669216 Compare May 8, 2025 09:52
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/multiproject-upload branch from 8700f95 to 5b8e333 Compare May 8, 2025 11:15
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/legacy-upload-context branch from 2669216 to 813fa81 Compare May 8, 2025 11:15
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/multiproject-upload branch from 5b8e333 to 2158289 Compare May 8, 2025 11:24
@szokeasaurusrex szokeasaurusrex changed the base branch from szokeasaurusrex/legacy-upload-context to szokeasaurusrex/chunked-artifact-request-slice May 8, 2025 11:25
@szokeasaurusrex
Copy link
Member Author

Hey @loewenheim, I have tested this. As an example, see the following artifact bundle, which I uploaded with sentry-cli sourcemaps upload -p szoke-test-1 -p szoke-test-2:

@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/multiproject-upload branch from 2158289 to 6c01bae Compare May 8, 2025 11:46
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/chunked-artifact-request-slice branch from 1bb1afc to f540dc1 Compare May 8, 2025 11:47
Base automatically changed from szokeasaurusrex/chunked-artifact-request-slice to master May 8, 2025 11:52
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/multiproject-upload branch from 6c01bae to 2c4b144 Compare May 8, 2025 12:11
It is now possible to upload sourcemaps to multiple projects at once, by passing the `-p`/`--project` flag multiple times to the `sentry-cli sourcemaps upload` command. Previously, it was possible to specify multiple projects via this flag, but all but the first project were ignored.

Multi-project sourcemaps uploads only work for Sentry servers which support chunked uploads – since this feature was added quite some time ago, we expect most self-hosted Sentry instances will support this. Older versions of Sentry continue to only support single-project uploads, but now, instead of silently ignoring all but the first project, an error is returned.

Closes #2408
let project = match projects {
[] => None,
[project] => Some(project.as_str()),
[_, _, ..] => Err(LegacyUploadContextError::ProjectMultiple)?,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern could also be _ but actually makes sense this way, because it clarifies that the list has at least two elements.

@szokeasaurusrex szokeasaurusrex enabled auto-merge (squash) May 8, 2025 12:32
@szokeasaurusrex szokeasaurusrex merged commit f5ea48c into master May 8, 2025
17 checks passed
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/multiproject-upload branch May 8, 2025 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants