diff --git a/src/api/data_types/chunking/build.rs b/src/api/data_types/chunking/build.rs index 25bac84033..6f5e17b737 100644 --- a/src/api/data_types/chunking/build.rs +++ b/src/api/data_types/chunking/build.rs @@ -9,6 +9,8 @@ pub struct ChunkedBuildRequest<'a> { pub chunks: &'a [Digest], #[serde(skip_serializing_if = "Option::is_none")] pub build_configuration: Option<&'a str>, + #[serde(skip_serializing_if = "Option::is_none")] + pub release_notes: Option<&'a str>, // VCS fields #[serde(skip_serializing_if = "Option::is_none")] pub head_sha: Option<&'a str>, diff --git a/src/api/mod.rs b/src/api/mod.rs index 32ec3db8fd..28633e33e9 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1034,10 +1034,7 @@ impl<'a> AuthenticatedApi<'a> { &self, org: &str, project: &str, - checksum: Digest, - chunks: &[Digest], - build_configuration: Option<&str>, - vcs_info: &VcsInfo<'_>, + request: &ChunkedBuildRequest<'_>, ) -> ApiResult { let url = format!( "/projects/{}/{}/files/preprodartifacts/assemble/", @@ -1046,19 +1043,7 @@ impl<'a> AuthenticatedApi<'a> { ); self.request(Method::Post, &url)? - .with_json_body(&ChunkedBuildRequest { - checksum, - chunks, - build_configuration, - head_sha: vcs_info.head_sha, - base_sha: vcs_info.base_sha, - provider: vcs_info.vcs_provider, - head_repo_name: vcs_info.head_repo_name, - base_repo_name: vcs_info.base_repo_name, - head_ref: vcs_info.head_ref, - base_ref: vcs_info.base_ref, - pr_number: vcs_info.pr_number, - })? + .with_json_body(&request)? .send()? .convert_rnf(ApiErrorKind::ProjectNotFound) } diff --git a/src/commands/build/upload.rs b/src/commands/build/upload.rs index 901c740dc7..dd425cc262 100644 --- a/src/commands/build/upload.rs +++ b/src/commands/build/upload.rs @@ -10,7 +10,9 @@ use symbolic::common::ByteView; use zip::write::SimpleFileOptions; use zip::{DateTime, ZipWriter}; -use crate::api::{Api, AuthenticatedApi, ChunkUploadCapability, ChunkedFileState, VcsInfo}; +use crate::api::{ + Api, AuthenticatedApi, ChunkUploadCapability, ChunkedBuildRequest, ChunkedFileState, VcsInfo, +}; use crate::config::Config; use crate::utils::args::ArgExt as _; #[cfg(all(target_os = "macos", target_arch = "aarch64"))] @@ -90,6 +92,11 @@ pub fn make_command(command: Command) -> Command { .long("build-configuration") .help("The build configuration to use for the upload. If not provided, the current version will be used.") ) + .arg( + Arg::new("release_notes") + .long("release-notes") + .help("The release notes to use for the upload.") + ) } pub fn execute(matches: &ArgMatches) -> Result<()> { @@ -169,6 +176,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { let pr_number = matches.get_one::("pr_number"); let build_configuration = matches.get_one("build_configuration").map(String::as_str); + let release_notes = matches.get_one("release_notes").map(String::as_str); let api = Api::current(); let authenticated_api = api.authenticated()?; @@ -238,6 +246,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { &org, &project, build_configuration, + release_notes, &vcs_info, ) { Ok(artifact_url) => { @@ -397,6 +406,7 @@ fn upload_file( org: &str, project: &str, build_configuration: Option<&str>, + release_notes: Option<&str>, vcs_info: &VcsInfo<'_>, ) -> Result { const SELF_HOSTED_ERROR_HINT: &str = "If you are using a self-hosted Sentry server, \ @@ -457,10 +467,20 @@ fn upload_file( let response = api.assemble_build( org, project, - checksum, - &checksums, - build_configuration, - vcs_info, + &ChunkedBuildRequest { + checksum, + chunks: &checksums, + build_configuration, + release_notes, + head_sha: vcs_info.head_sha, + base_sha: vcs_info.base_sha, + provider: vcs_info.vcs_provider, + head_repo_name: vcs_info.head_repo_name, + base_repo_name: vcs_info.base_repo_name, + head_ref: vcs_info.head_ref, + base_ref: vcs_info.base_ref, + pr_number: vcs_info.pr_number, + }, )?; chunks.retain(|Chunk((digest, _))| response.missing_chunks.contains(digest)); diff --git a/tests/integration/_cases/build/build-upload-help-macos.trycmd b/tests/integration/_cases/build/build-upload-help-macos.trycmd index 122b7838d8..2aeba20894 100644 --- a/tests/integration/_cases/build/build-upload-help-macos.trycmd +++ b/tests/integration/_cases/build/build-upload-help-macos.trycmd @@ -50,6 +50,8 @@ Options: --build-configuration The build configuration to use for the upload. If not provided, the current version will be used. + --release-notes + The release notes to use for the upload. -h, --help Print help diff --git a/tests/integration/_cases/build/build-upload-help-not-macos.trycmd b/tests/integration/_cases/build/build-upload-help-not-macos.trycmd index a69c78bb0c..5f6ee57c84 100644 --- a/tests/integration/_cases/build/build-upload-help-not-macos.trycmd +++ b/tests/integration/_cases/build/build-upload-help-not-macos.trycmd @@ -49,6 +49,8 @@ Options: --build-configuration The build configuration to use for the upload. If not provided, the current version will be used. + --release-notes + The release notes to use for the upload. -h, --help Print help