-
-
Notifications
You must be signed in to change notification settings - Fork 235
chore(launchpad): Remove assembly polling for mobile app + print artifact id if present #2683
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,6 @@ | |
use serde::{Deserialize, Serialize}; | ||
use sha1_smol::Digest; | ||
|
||
use super::ChunkedFileState; | ||
|
||
#[derive(Debug, Serialize)] | ||
pub struct ChunkedMobileAppRequest<'a> { | ||
pub checksum: Digest, | ||
|
@@ -17,7 +15,6 @@ pub struct ChunkedMobileAppRequest<'a> { | |
#[derive(Debug, Deserialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct AssembleMobileAppResponse { | ||
pub state: ChunkedFileState, | ||
pub missing_chunks: Vec<Digest>, | ||
pub detail: Option<String>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we aren't using these two fields anymore |
||
pub artifact_id: Option<String>, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,15 +11,14 @@ use clap::{Arg, ArgAction, ArgMatches, Command}; | |
use indicatif::ProgressStyle; | ||
use itertools::Itertools as _; | ||
use log::{debug, info, warn}; | ||
use sha1_smol::Digest; | ||
use symbolic::common::ByteView; | ||
use zip::write::SimpleFileOptions; | ||
use zip::{DateTime, ZipWriter}; | ||
|
||
use crate::api::{Api, AuthenticatedApi, ChunkUploadCapability}; | ||
use crate::config::Config; | ||
use crate::utils::args::ArgExt as _; | ||
use crate::utils::chunks::{upload_chunks, Chunk, ASSEMBLE_POLL_INTERVAL}; | ||
use crate::utils::chunks::{upload_chunks, Chunk}; | ||
use crate::utils::fs::get_sha1_checksums; | ||
#[cfg(all(target_os = "macos", target_arch = "aarch64"))] | ||
use crate::utils::fs::TempDir; | ||
|
@@ -143,8 +142,16 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { | |
sha.as_deref(), | ||
build_configuration, | ||
) { | ||
Ok(_) => { | ||
info!("Successfully uploaded file: {}", path.display()); | ||
Ok(artifact_id) => { | ||
if let Some(id) = artifact_id { | ||
info!( | ||
"Successfully uploaded file: {} (artifact_id: {})", | ||
path.display(), | ||
id | ||
); | ||
} else { | ||
info!("Successfully uploaded file: {}", path.display()); | ||
} | ||
uploaded_paths.push(path.to_path_buf()); | ||
} | ||
Err(e) => { | ||
|
@@ -344,7 +351,7 @@ fn upload_file( | |
project: &str, | ||
sha: Option<&str>, | ||
build_configuration: Option<&str>, | ||
) -> Result<()> { | ||
) -> Result<Option<String>> { | ||
const SELF_HOSTED_ERROR_HINT: &str = "If you are using a self-hosted Sentry server, \ | ||
update to the latest version of Sentry to use the mobile-app upload command."; | ||
|
||
|
@@ -399,61 +406,7 @@ fn upload_file( | |
} else { | ||
println!("Nothing to upload, all files are on the server"); | ||
} | ||
|
||
poll_assemble( | ||
api, | ||
checksum, | ||
&checksums, | ||
org, | ||
project, | ||
sha, | ||
build_configuration, | ||
)?; | ||
Ok(()) | ||
} | ||
|
||
fn poll_assemble( | ||
api: &AuthenticatedApi, | ||
checksum: Digest, | ||
chunks: &[Digest], | ||
org: &str, | ||
project: &str, | ||
sha: Option<&str>, | ||
build_configuration: Option<&str>, | ||
) -> Result<()> { | ||
debug!("Polling assemble for checksum: {}", checksum); | ||
|
||
let progress_style = ProgressStyle::default_spinner().template("{spinner} Processing files..."); | ||
let pb = ProgressBar::new_spinner(); | ||
|
||
pb.enable_steady_tick(100); | ||
pb.set_style(progress_style); | ||
|
||
let response = loop { | ||
let response = | ||
api.assemble_mobile_app(org, project, checksum, chunks, sha, build_configuration)?; | ||
|
||
if response.state.is_finished() { | ||
break response; | ||
} | ||
|
||
std::thread::sleep(ASSEMBLE_POLL_INTERVAL); | ||
}; | ||
|
||
pb.finish_with_duration("Processing"); | ||
|
||
if response.state.is_err() { | ||
let message = response.detail.as_deref().unwrap_or("unknown error"); | ||
bail!("Failed to process uploaded files: {}", message); | ||
} | ||
|
||
if response.state.is_pending() { | ||
info!("File upload complete (processing pending on server)"); | ||
} else { | ||
info!("File processing complete"); | ||
} | ||
|
||
Ok(()) | ||
Ok(response.artifact_id) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to make a call to the assemble endpoint after uploading the chunks, so that the server begins the assembly process. I don't expect these changes to work, as the code is currently written. |
||
} | ||
|
||
#[cfg(not(windows))] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt we want to be ignoring this, as the
state
can indicate an error