@@ -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,28 @@ 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
) ;
172
+ <<<<<<< Updated upstream
173
173
if uploaded_paths_and_ids. len( ) < 3 {
174
174
for ( path, artifact_id) in & uploaded_paths_and_ids {
175
175
let url = format ! ( "{base_url}/{org}/preprod/{project}/{artifact_id}" ) ;
176
176
println ! ( " - {} ({url})" , path. display( ) ) ;
177
+ =======
178
+ if uploaded_paths_and_urls. len ( ) < 3 {
179
+ for ( path, artifact_url) in & uploaded_paths_and_urls {
180
+ println ! ( " - {} {artifact_url}" , path. display( ) ) ;
181
+ >>>>>>> Stashed changes
177
182
}
178
183
}
179
184
}
@@ -283,7 +288,7 @@ fn handle_directory(path: &Path) -> Result<TempFile> {
283
288
normalize_directory ( path, temp_dir. path ( ) )
284
289
}
285
290
286
- /// Returns artifact id if upload was successful.
291
+ /// Returns artifact url if upload was successful.
287
292
fn upload_file (
288
293
api : & AuthenticatedApi ,
289
294
bytes : & [ u8 ] ,
@@ -336,15 +341,16 @@ fn upload_file(
336
341
// In the normal case we go through this loop exactly twice:
337
342
// 1. state=not_found
338
343
// 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)
344
+ // 2. artifact_url set so we're done (likely state=created)
340
345
//
341
346
// In the case where all the chunks are already on the server we go
342
347
// through only once:
343
- // 1. state=ok, artifact_id set
348
+ // 1. state=created, artifact_url set
344
349
//
345
350
// In the case where something went wrong (which could be on either
346
351
// iteration of the loop) we get:
347
- // n. state=err, artifact_id unset
352
+ // n. state=error, artifact_url unset
353
+
348
354
let result = loop {
349
355
let response =
350
356
api. assemble_mobile_app ( org, project, checksum, & checksums, sha, build_configuration) ?;
@@ -357,16 +363,20 @@ fn upload_file(
357
363
) ;
358
364
upload_chunks ( & chunks, & chunk_upload_options, upload_progress_style) ?;
359
365
}
366
+ <<<<<<< Updated upstream
360
367
361
368
// state.is_err() is not the same as this since it also returns
362
369
// true for ChunkedFileState::NotFound.
370
+ =======
371
+
372
+ >>>>>>> Stashed changes
363
373
if response. state == ChunkedFileState :: Error {
364
374
let message = response. detail . as_deref ( ) . unwrap_or ( "unknown error" ) ;
365
375
bail ! ( "Failed to process uploaded files: {}" , message) ;
366
376
}
367
377
368
- if let Some ( artifact_id ) = response. artifact_id {
369
- break Ok ( artifact_id ) ;
378
+ if let Some ( artifact_url ) = response. artifact_url {
379
+ break Ok ( artifact_url ) ;
370
380
}
371
381
372
382
if response. state . is_finished ( ) {
0 commit comments