Skip to content

Commit 7f0e609

Browse files
chore(sourcemaps): Remove support for release bundle uploads (#2961)
### Description Remove support for the deprecated release bundle uploads. Source maps are always uploaded as artifact bundles, now. Also, we now assume all Sentry servers support `ArtifactBundle` and `ArtifactBundleV2`. ### Issues - Resolves #2842 - Resolves [CLI-188](https://linear.app/getsentry/issue/CLI-188/remove-support-for-release-bundle-uploads)
1 parent 8cca6fa commit 7f0e609

File tree

15 files changed

+83
-375
lines changed

15 files changed

+83
-375
lines changed

src/api/data_types/chunking/upload/capability.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ use serde::{Deserialize, Deserializer};
22

33
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
44
pub enum ChunkUploadCapability {
5-
/// Chunked upload of standalone artifact bundles
6-
ArtifactBundles,
7-
8-
/// Like `ArtifactBundles`, but with deduplicated chunk
9-
/// upload.
10-
ArtifactBundlesV2,
11-
125
/// Upload of Dart symbol maps
136
DartSymbolMap,
147

@@ -28,8 +21,6 @@ impl<'de> Deserialize<'de> for ChunkUploadCapability {
2821
D: Deserializer<'de>,
2922
{
3023
Ok(match String::deserialize(deserializer)?.as_str() {
31-
"artifact_bundles" => ChunkUploadCapability::ArtifactBundles,
32-
"artifact_bundles_v2" => ChunkUploadCapability::ArtifactBundlesV2,
3324
"dartsymbolmap" => ChunkUploadCapability::DartSymbolMap,
3425
"preprod_artifacts" => ChunkUploadCapability::PreprodArtifacts,
3526
"proguard" => ChunkUploadCapability::Proguard,

src/api/mod.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -749,32 +749,6 @@ impl AuthenticatedApi<'_> {
749749
.convert_rnf(ApiErrorKind::ProjectNotFound)
750750
}
751751

752-
#[deprecated = "release bundle uploads are deprecated in favor of artifact bundle uploads"]
753-
pub fn assemble_release_artifacts(
754-
&self,
755-
org: &str,
756-
release: &str,
757-
checksum: Digest,
758-
chunks: &[Digest],
759-
) -> ApiResult<AssembleArtifactsResponse> {
760-
let url = format!(
761-
"/organizations/{}/releases/{}/assemble/",
762-
PathArg(org),
763-
PathArg(release)
764-
);
765-
766-
self.request(Method::Post, &url)?
767-
.with_json_body(&ChunkedArtifactRequest {
768-
checksum,
769-
chunks,
770-
projects: &[],
771-
version: None,
772-
dist: None,
773-
})?
774-
.send()?
775-
.convert_rnf(ApiErrorKind::ReleaseNotFound)
776-
}
777-
778752
pub fn assemble_artifact_bundle(
779753
&self,
780754
org: &str,

src/commands/sourcemaps/upload.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use glob::{glob_with, MatchOptions};
1010
use itertools::Itertools as _;
1111
use log::{debug, warn};
1212

13-
use crate::api::{Api, ChunkUploadCapability};
13+
use crate::api::Api;
1414
use crate::config::Config;
1515
use crate::constants::DEFAULT_MAX_WAIT;
1616
use crate::utils::args::validate_distribution;
@@ -429,19 +429,13 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
429429
let projects = config.get_projects(matches)?;
430430
let api = Api::current();
431431
let mut processor = SourceMapProcessor::new();
432-
let mut chunk_upload_options = api.authenticated()?.get_chunk_upload_options(&org)?;
432+
let chunk_upload_options = api.authenticated()?.get_chunk_upload_options(&org)?;
433433

434434
if matches.get_flag("use_artifact_bundle")
435435
|| env::var("SENTRY_FORCE_ARTIFACT_BUNDLES").ok().as_deref() == Some("1")
436436
{
437437
log::warn!("The --use-artifact-bundle option and the SENTRY_FORCE_ARTIFACT_BUNDLES environment variable \
438438
are both deprecated, and both will be removed in the next major version.");
439-
440-
if !chunk_upload_options.supports(ChunkUploadCapability::ArtifactBundles) {
441-
chunk_upload_options
442-
.accept
443-
.push(ChunkUploadCapability::ArtifactBundles);
444-
}
445439
}
446440

447441
if matches.contains_id("bundle") && matches.contains_id("bundle_sourcemap") {

src/utils/file_upload.rs

Lines changed: 21 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ use std::str;
77
use std::sync::Arc;
88
use std::time::{Duration, Instant};
99

10-
use anyhow::{anyhow, bail, Result};
10+
use anyhow::{bail, Result};
1111
use console::style;
1212
use sha1_smol::Digest;
1313
use symbolic::common::ByteView;
1414
use symbolic::debuginfo::js;
1515
use symbolic::debuginfo::sourcebundle::SourceFileType;
1616

17-
use crate::api::NewRelease;
18-
use crate::api::{Api, ChunkServerOptions, ChunkUploadCapability};
17+
use crate::api::{Api, ChunkServerOptions};
1918
use crate::constants::DEFAULT_MAX_WAIT;
2019
use crate::utils::chunks::{upload_chunks, Chunk, ASSEMBLE_POLL_INTERVAL};
2120
use crate::utils::fs::get_sha1_checksums;
@@ -25,39 +24,6 @@ use crate::utils::source_bundle;
2524

2625
use super::file_search::ReleaseFileMatch;
2726

28-
/// Old versions of Sentry cannot assemble artifact bundles straight away, they require
29-
/// that those bundles are associated to a release.
30-
///
31-
/// This function checks whether the configured server supports artifact bundles
32-
/// and only creates a release if the server requires that.
33-
pub fn initialize_legacy_release_upload(context: &UploadContext) -> Result<()> {
34-
// if the remote sentry service supports artifact bundles, we don't
35-
// need to do anything here. Artifact bundles will also only work
36-
// if a project is provided which is technically unnecessary for the
37-
// legacy upload though it will unlikely to be what users want.
38-
let chunk_options = context.chunk_upload_options;
39-
if chunk_options.supports(ChunkUploadCapability::ArtifactBundles)
40-
|| chunk_options.supports(ChunkUploadCapability::ArtifactBundlesV2)
41-
{
42-
return Ok(());
43-
}
44-
45-
if let Some(version) = context.release {
46-
let api = Api::current();
47-
api.authenticated()?.new_release(
48-
context.org,
49-
&NewRelease {
50-
version: version.to_owned(),
51-
projects: context.projects.into(),
52-
..Default::default()
53-
},
54-
)?;
55-
} else {
56-
bail!("This version of Sentry does not support artifact bundles. A release slug is required (provide with --release or by setting the SENTRY_RELEASE environment variable)");
57-
}
58-
Ok(())
59-
}
60-
6127
#[derive(Debug, Clone)]
6228
pub struct UploadContext<'a> {
6329
pub org: &'a str,
@@ -70,13 +36,6 @@ pub struct UploadContext<'a> {
7036
pub chunk_upload_options: &'a ChunkServerOptions,
7137
}
7238

73-
impl UploadContext<'_> {
74-
pub fn release(&self) -> Result<&str> {
75-
self.release
76-
.ok_or_else(|| anyhow!("A release slug is required (provide with --release or by setting the SENTRY_RELEASE environment variable)"))
77-
}
78-
}
79-
8039
#[derive(Eq, PartialEq, Debug, Copy, Clone, Hash)]
8140
pub enum LogLevel {
8241
Warning,
@@ -227,8 +186,6 @@ impl<'a> FileUpload<'a> {
227186
}
228187

229188
pub fn upload(&self) -> Result<()> {
230-
// multiple projects OK
231-
initialize_legacy_release_upload(self.context)?;
232189
upload_files_chunked(self.context, &self.files, self.context.chunk_upload_options)
233190
}
234191
}
@@ -256,39 +213,16 @@ fn poll_assemble(
256213
let api = Api::current();
257214
let authenticated_api = api.authenticated()?;
258215

259-
let server_supports_artifact_bundles = options.supports(ChunkUploadCapability::ArtifactBundles)
260-
|| options.supports(ChunkUploadCapability::ArtifactBundlesV2);
261-
262-
if !server_supports_artifact_bundles {
263-
log::warn!(
264-
"[DEPRECATION NOTICE] Your Sentry server does not support artifact bundle \
265-
uploads. Falling back to deprecated release bundle upload. Support for this \
266-
deprecated upload method will be removed in Sentry CLI 3.0.0. Please upgrade your \
267-
Sentry server, or if you cannot upgrade, pin your Sentry CLI version to 2.x, so \
268-
you don't get upgraded to 3.x when it is released."
269-
);
270-
}
271-
272216
let response = loop {
273217
// prefer standalone artifact bundle upload over legacy release based upload
274-
let response = if server_supports_artifact_bundles {
275-
authenticated_api.assemble_artifact_bundle(
276-
context.org,
277-
context.projects,
278-
checksum,
279-
chunks,
280-
context.release,
281-
context.dist,
282-
)?
283-
} else {
284-
#[expect(deprecated, reason = "fallback to legacy upload")]
285-
authenticated_api.assemble_release_artifacts(
286-
context.org,
287-
context.release()?,
288-
checksum,
289-
chunks,
290-
)?
291-
};
218+
let response = authenticated_api.assemble_artifact_bundle(
219+
context.org,
220+
context.projects,
221+
checksum,
222+
chunks,
223+
context.release,
224+
context.dist,
225+
)?;
292226

293227
// Poll until there is a response, unless the user has specified to skip polling. In
294228
// that case, we return the potentially partial response from the server. This might
@@ -359,23 +293,16 @@ fn upload_files_chunked(
359293
style(">").dim(),
360294
));
361295

362-
// Filter out chunks that are already on the server. This only matters if the server supports
363-
// `ArtifactBundlesV2`, otherwise the `missing_chunks` field is meaningless.
364-
if let Some(projects) = options
365-
.supports(ChunkUploadCapability::ArtifactBundlesV2)
366-
.then_some(context.projects)
367-
{
368-
let api = Api::current();
369-
let response = api.authenticated()?.assemble_artifact_bundle(
370-
context.org,
371-
projects,
372-
checksum,
373-
&checksums,
374-
context.release,
375-
context.dist,
376-
)?;
377-
chunks.retain(|Chunk((digest, _))| response.missing_chunks.contains(digest));
378-
};
296+
let api = Api::current();
297+
let response = api.authenticated()?.assemble_artifact_bundle(
298+
context.org,
299+
context.projects,
300+
checksum,
301+
&checksums,
302+
context.release,
303+
context.dist,
304+
)?;
305+
chunks.retain(|Chunk((digest, _))| response.missing_chunks.contains(digest));
379306

380307
if !chunks.is_empty() {
381308
upload_chunks(&chunks, options, progress_style)?;
@@ -410,21 +337,10 @@ fn print_upload_context_details(context: &UploadContext) {
410337
style("> Dist:").dim(),
411338
style(context.dist.unwrap_or("None")).yellow()
412339
);
413-
let upload_type = if context
414-
.chunk_upload_options
415-
.supports(ChunkUploadCapability::ArtifactBundles)
416-
|| context
417-
.chunk_upload_options
418-
.supports(ChunkUploadCapability::ArtifactBundlesV2)
419-
{
420-
"artifact bundle"
421-
} else {
422-
"release bundle"
423-
};
424340
println!(
425341
"{} {}",
426342
style("> Upload type:").dim(),
427-
style(upload_type).yellow()
343+
style("artifact bundle").yellow()
428344
);
429345
}
430346

src/utils/sourcemaps.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ use symbolic::debuginfo::sourcebundle::SourceFileType;
1919
use url::Url;
2020

2121
use crate::utils::file_search::ReleaseFileMatch;
22-
use crate::utils::file_upload::{
23-
initialize_legacy_release_upload, FileUpload, SourceFile, SourceFiles, UploadContext,
24-
};
22+
use crate::utils::file_upload::{FileUpload, SourceFile, SourceFiles, UploadContext};
2523
use crate::utils::fs;
2624
use crate::utils::logging::is_quiet_mode;
2725
use crate::utils::progress::ProgressBar;
@@ -666,7 +664,6 @@ impl SourceMapProcessor {
666664
/// Uploads all files, and on success, returns the number of files that were
667665
/// uploaded, wrapped in Ok()
668666
pub fn upload(&mut self, context: &UploadContext<'_>) -> Result<usize> {
669-
initialize_legacy_release_upload(context)?;
670667
self.flush_pending_sources();
671668

672669
// If there is no release, we have to check that the files at least

tests/integration/_cases/sourcemaps/sourcemaps-upload-no-dedupe.trycmd

Lines changed: 0 additions & 32 deletions
This file was deleted.

tests/integration/_cases/sourcemaps/sourcemaps-upload-skip-already-uploaded.trycmd

Lines changed: 0 additions & 31 deletions
This file was deleted.

tests/integration/_cases/sourcemaps/sourcemaps-upload-successfully-upload-file.trycmd

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)