@@ -7,15 +7,14 @@ use std::str;
77use std:: sync:: Arc ;
88use std:: time:: { Duration , Instant } ;
99
10- use anyhow:: { anyhow , bail, Result } ;
10+ use anyhow:: { bail, Result } ;
1111use console:: style;
1212use sha1_smol:: Digest ;
1313use symbolic:: common:: ByteView ;
1414use symbolic:: debuginfo:: js;
1515use symbolic:: debuginfo:: sourcebundle:: SourceFileType ;
1616
17- use crate :: api:: NewRelease ;
18- use crate :: api:: { Api , ChunkServerOptions , ChunkUploadCapability } ;
17+ use crate :: api:: { Api , ChunkServerOptions } ;
1918use crate :: constants:: DEFAULT_MAX_WAIT ;
2019use crate :: utils:: chunks:: { upload_chunks, Chunk , ASSEMBLE_POLL_INTERVAL } ;
2120use crate :: utils:: fs:: get_sha1_checksums;
@@ -25,39 +24,6 @@ use crate::utils::source_bundle;
2524
2625use 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 ) ]
6228pub 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 ) ]
8140pub 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
0 commit comments