Skip to content

Commit 87be223

Browse files
authored
feat(mobile-app): Add release notes option (#2712)
Adds an option for release notes, used by build distribution
1 parent d20139c commit 87be223

File tree

5 files changed

+33
-22
lines changed

5 files changed

+33
-22
lines changed

src/api/data_types/chunking/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ pub struct ChunkedBuildRequest<'a> {
99
pub chunks: &'a [Digest],
1010
#[serde(skip_serializing_if = "Option::is_none")]
1111
pub build_configuration: Option<&'a str>,
12+
#[serde(skip_serializing_if = "Option::is_none")]
13+
pub release_notes: Option<&'a str>,
1214
// VCS fields
1315
#[serde(skip_serializing_if = "Option::is_none")]
1416
pub head_sha: Option<&'a str>,

src/api/mod.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,10 +1034,7 @@ impl<'a> AuthenticatedApi<'a> {
10341034
&self,
10351035
org: &str,
10361036
project: &str,
1037-
checksum: Digest,
1038-
chunks: &[Digest],
1039-
build_configuration: Option<&str>,
1040-
vcs_info: &VcsInfo<'_>,
1037+
request: &ChunkedBuildRequest<'_>,
10411038
) -> ApiResult<AssembleBuildResponse> {
10421039
let url = format!(
10431040
"/projects/{}/{}/files/preprodartifacts/assemble/",
@@ -1046,19 +1043,7 @@ impl<'a> AuthenticatedApi<'a> {
10461043
);
10471044

10481045
self.request(Method::Post, &url)?
1049-
.with_json_body(&ChunkedBuildRequest {
1050-
checksum,
1051-
chunks,
1052-
build_configuration,
1053-
head_sha: vcs_info.head_sha,
1054-
base_sha: vcs_info.base_sha,
1055-
provider: vcs_info.vcs_provider,
1056-
head_repo_name: vcs_info.head_repo_name,
1057-
base_repo_name: vcs_info.base_repo_name,
1058-
head_ref: vcs_info.head_ref,
1059-
base_ref: vcs_info.base_ref,
1060-
pr_number: vcs_info.pr_number,
1061-
})?
1046+
.with_json_body(&request)?
10621047
.send()?
10631048
.convert_rnf(ApiErrorKind::ProjectNotFound)
10641049
}

src/commands/build/upload.rs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ use symbolic::common::ByteView;
1010
use zip::write::SimpleFileOptions;
1111
use zip::{DateTime, ZipWriter};
1212

13-
use crate::api::{Api, AuthenticatedApi, ChunkUploadCapability, ChunkedFileState, VcsInfo};
13+
use crate::api::{
14+
Api, AuthenticatedApi, ChunkUploadCapability, ChunkedBuildRequest, ChunkedFileState, VcsInfo,
15+
};
1416
use crate::config::Config;
1517
use crate::utils::args::ArgExt as _;
1618
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
@@ -90,6 +92,11 @@ pub fn make_command(command: Command) -> Command {
9092
.long("build-configuration")
9193
.help("The build configuration to use for the upload. If not provided, the current version will be used.")
9294
)
95+
.arg(
96+
Arg::new("release_notes")
97+
.long("release-notes")
98+
.help("The release notes to use for the upload.")
99+
)
93100
}
94101

95102
pub fn execute(matches: &ArgMatches) -> Result<()> {
@@ -169,6 +176,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
169176
let pr_number = matches.get_one::<u32>("pr_number");
170177

171178
let build_configuration = matches.get_one("build_configuration").map(String::as_str);
179+
let release_notes = matches.get_one("release_notes").map(String::as_str);
172180

173181
let api = Api::current();
174182
let authenticated_api = api.authenticated()?;
@@ -238,6 +246,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
238246
&org,
239247
&project,
240248
build_configuration,
249+
release_notes,
241250
&vcs_info,
242251
) {
243252
Ok(artifact_url) => {
@@ -397,6 +406,7 @@ fn upload_file(
397406
org: &str,
398407
project: &str,
399408
build_configuration: Option<&str>,
409+
release_notes: Option<&str>,
400410
vcs_info: &VcsInfo<'_>,
401411
) -> Result<String> {
402412
const SELF_HOSTED_ERROR_HINT: &str = "If you are using a self-hosted Sentry server, \
@@ -457,10 +467,20 @@ fn upload_file(
457467
let response = api.assemble_build(
458468
org,
459469
project,
460-
checksum,
461-
&checksums,
462-
build_configuration,
463-
vcs_info,
470+
&ChunkedBuildRequest {
471+
checksum,
472+
chunks: &checksums,
473+
build_configuration,
474+
release_notes,
475+
head_sha: vcs_info.head_sha,
476+
base_sha: vcs_info.base_sha,
477+
provider: vcs_info.vcs_provider,
478+
head_repo_name: vcs_info.head_repo_name,
479+
base_repo_name: vcs_info.base_repo_name,
480+
head_ref: vcs_info.head_ref,
481+
base_ref: vcs_info.base_ref,
482+
pr_number: vcs_info.pr_number,
483+
},
464484
)?;
465485
chunks.retain(|Chunk((digest, _))| response.missing_chunks.contains(digest));
466486

tests/integration/_cases/build/build-upload-help-macos.trycmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Options:
5050
--build-configuration <build_configuration>
5151
The build configuration to use for the upload. If not provided, the current version will
5252
be used.
53+
--release-notes <release_notes>
54+
The release notes to use for the upload.
5355
-h, --help
5456
Print help
5557

tests/integration/_cases/build/build-upload-help-not-macos.trycmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ Options:
4949
--build-configuration <build_configuration>
5050
The build configuration to use for the upload. If not provided, the current version will
5151
be used.
52+
--release-notes <release_notes>
53+
The release notes to use for the upload.
5254
-h, --help
5355
Print help
5456

0 commit comments

Comments
 (0)