@@ -117,9 +117,8 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
117
117
118
118
let config = Config :: current ( ) ;
119
119
let ( org, project) = config. get_org_and_project ( matches) ?;
120
- let base_url = config. get_base_url ( ) ?;
121
120
122
- let mut uploaded_paths_and_ids = vec ! [ ] ;
121
+ let mut uploaded_paths_and_urls = vec ! [ ] ;
123
122
let mut errored_paths_and_reasons = vec ! [ ] ;
124
123
for ( path, zip) in normalized_zips {
125
124
info ! ( "Uploading file: {}" , path. display( ) ) ;
@@ -132,9 +131,9 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
132
131
sha. as_deref ( ) ,
133
132
build_configuration,
134
133
) {
135
- Ok ( artifact_id ) => {
134
+ Ok ( artifact_url ) => {
136
135
info ! ( "Successfully uploaded file: {}" , path. display( ) ) ;
137
- uploaded_paths_and_ids . push ( ( path. to_path_buf ( ) , artifact_id ) ) ;
136
+ uploaded_paths_and_urls . push ( ( path. to_path_buf ( ) , artifact_url ) ) ;
138
137
}
139
138
Err ( e) => {
140
139
debug ! ( "Failed to upload file at path {}: {}" , path. display( ) , e) ;
@@ -158,22 +157,21 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
158
157
}
159
158
}
160
159
161
- if uploaded_paths_and_ids . is_empty ( ) {
160
+ if uploaded_paths_and_urls . is_empty ( ) {
162
161
bail ! ( "Failed to upload any files" ) ;
163
162
} else {
164
163
println ! (
165
164
"Successfully uploaded {} file{} to Sentry" ,
166
- uploaded_paths_and_ids . len( ) ,
167
- if uploaded_paths_and_ids . len( ) == 1 {
165
+ uploaded_paths_and_urls . len( ) ,
166
+ if uploaded_paths_and_urls . len( ) == 1 {
168
167
""
169
168
} else {
170
169
"s"
171
170
}
172
171
) ;
173
- if uploaded_paths_and_ids. len ( ) < 3 {
174
- for ( path, artifact_id) in & uploaded_paths_and_ids {
175
- let url = format ! ( "{base_url}/{org}/preprod/{project}/{artifact_id}" ) ;
176
- println ! ( " - {} ({url})" , path. display( ) ) ;
172
+ if uploaded_paths_and_urls. len ( ) < 3 {
173
+ for ( path, artifact_url) in & uploaded_paths_and_urls {
174
+ println ! ( " - {} ({artifact_url})" , path. display( ) ) ;
177
175
}
178
176
}
179
177
}
@@ -283,7 +281,7 @@ fn handle_directory(path: &Path) -> Result<TempFile> {
283
281
normalize_directory ( path, temp_dir. path ( ) )
284
282
}
285
283
286
- /// Returns artifact id if upload was successful.
284
+ /// Returns artifact url if upload was successful.
287
285
fn upload_file (
288
286
api : & AuthenticatedApi ,
289
287
bytes : & [ u8 ] ,
@@ -336,15 +334,16 @@ fn upload_file(
336
334
// In the normal case we go through this loop exactly twice:
337
335
// 1. state=not_found
338
336
// server tells us the we need to send every chunk and we do so
339
- // 2. artifact_id set so we're done (likely state=created)
337
+ // 2. artifact_url set so we're done (likely state=created)
340
338
//
341
339
// In the case where all the chunks are already on the server we go
342
340
// through only once:
343
- // 1. state=ok, artifact_id set
341
+ // 1. state=created, artifact_url set
344
342
//
345
343
// In the case where something went wrong (which could be on either
346
344
// iteration of the loop) we get:
347
- // n. state=err, artifact_id unset
345
+ // n. state=error, artifact_url unset
346
+
348
347
let result = loop {
349
348
let response =
350
349
api. assemble_mobile_app ( org, project, checksum, & checksums, sha, build_configuration) ?;
@@ -365,13 +364,13 @@ fn upload_file(
365
364
bail ! ( "Failed to process uploaded files: {}" , message) ;
366
365
}
367
366
368
- if let Some ( artifact_id ) = response. artifact_id {
369
- break Ok ( artifact_id ) ;
367
+ if let Some ( artifact_url ) = response. artifact_url {
368
+ break Ok ( artifact_url ) ;
370
369
}
371
370
372
371
if response. state . is_finished ( ) {
373
372
bail ! (
374
- "File upload is_finished() but did not succeeded (returning artifact_id) or error"
373
+ "File upload is_finished() but did not succeeded or error"
375
374
) ;
376
375
}
377
376
} ;
0 commit comments