Skip to content

Commit 88e28bc

Browse files
committed
feat(mobile-app): Add release notes option
1 parent 96f3fcb commit 88e28bc

File tree

5 files changed

+33
-22
lines changed

5 files changed

+33
-22
lines changed

src/api/data_types/chunking/mobile_app.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub struct ChunkedMobileAppRequest<'a> {
1010
pub chunks: &'a [Digest],
1111
#[serde(skip_serializing_if = "Option::is_none")]
1212
pub build_configuration: Option<&'a str>,
13+
pub release_notes: Option<&'a str>,
1314
// VCS fields
1415
#[serde(skip_serializing_if = "Option::is_none")]
1516
pub head_sha: Option<&'a str>,

src/api/mod.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,10 +1035,7 @@ impl<'a> AuthenticatedApi<'a> {
10351035
&self,
10361036
org: &str,
10371037
project: &str,
1038-
checksum: Digest,
1039-
chunks: &[Digest],
1040-
build_configuration: Option<&str>,
1041-
vcs_info: &VcsInfo<'_>,
1038+
request: &ChunkedMobileAppRequest<'_>,
10421039
) -> ApiResult<AssembleMobileAppResponse> {
10431040
let url = format!(
10441041
"/projects/{}/{}/files/preprodartifacts/assemble/",
@@ -1047,19 +1044,7 @@ impl<'a> AuthenticatedApi<'a> {
10471044
);
10481045

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

src/commands/mobile_app/upload.rs

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ 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, ChunkedFileState, ChunkedMobileAppRequest,
15+
VcsInfo,
16+
};
1417
use crate::config::Config;
1518
use crate::utils::args::ArgExt as _;
1619
use crate::utils::chunks::{upload_chunks, Chunk};
@@ -91,6 +94,11 @@ pub fn make_command(command: Command) -> Command {
9194
.long("build-configuration")
9295
.help("The build configuration to use for the upload. If not provided, the current version will be used.")
9396
)
97+
.arg(
98+
Arg::new("release_notes")
99+
.long("release-notes")
100+
.help("The release notes to use for the upload.")
101+
)
94102
}
95103

96104
pub fn execute(matches: &ArgMatches) -> Result<()> {
@@ -145,6 +153,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
145153
let pr_number = matches.get_one::<u32>("pr_number");
146154

147155
let build_configuration = matches.get_one("build_configuration").map(String::as_str);
156+
let release_notes = matches.get_one("release_notes").map(String::as_str);
148157

149158
let api = Api::current();
150159
let authenticated_api = api.authenticated()?;
@@ -217,6 +226,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
217226
&org,
218227
&project,
219228
build_configuration,
229+
release_notes,
220230
&vcs_info,
221231
) {
222232
Ok(artifact_url) => {
@@ -376,6 +386,7 @@ fn upload_file(
376386
org: &str,
377387
project: &str,
378388
build_configuration: Option<&str>,
389+
release_notes: Option<&str>,
379390
vcs_info: &VcsInfo<'_>,
380391
) -> Result<String> {
381392
const SELF_HOSTED_ERROR_HINT: &str = "If you are using a self-hosted Sentry server, \
@@ -436,10 +447,20 @@ fn upload_file(
436447
let response = api.assemble_mobile_app(
437448
org,
438449
project,
439-
checksum,
440-
&checksums,
441-
build_configuration,
442-
vcs_info,
450+
&ChunkedMobileAppRequest {
451+
checksum,
452+
chunks: &checksums,
453+
build_configuration,
454+
release_notes,
455+
head_sha: vcs_info.head_sha,
456+
base_sha: vcs_info.base_sha,
457+
provider: vcs_info.vcs_provider,
458+
head_repo_name: vcs_info.head_repo_name,
459+
base_repo_name: vcs_info.base_repo_name,
460+
head_ref: vcs_info.head_ref,
461+
base_ref: vcs_info.base_ref,
462+
pr_number: vcs_info.pr_number,
463+
},
443464
)?;
444465
chunks.retain(|Chunk((digest, _))| response.missing_chunks.contains(digest));
445466

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

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

tests/integration/_cases/mobile_app/mobile_app-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)