Skip to content

Commit c487b6e

Browse files
noahsmartinclaudeszokeasaurusrex
authored
feat(build): Add --install-group parameter to build upload (#3094)
Add support for install groups in build uploads. This parameter allows specifying one or more groups that control update visibility. Builds with at least one matching install group will be shown updates for each other. --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Daniel Szoke <daniel.szoke@sentry.io>
1 parent 59701d1 commit c487b6e

5 files changed

Lines changed: 52 additions & 15 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Features
6+
7+
- Add `--install-group` parameter to `sentry-cli build upload` for controlling update visibility between builds ([#3094](https://github.com/getsentry/sentry-cli/pull/3094))
8+
39
## 3.1.0
410

511
### New Features

src/api/data_types/chunking/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ pub struct ChunkedBuildRequest<'a> {
1313
pub build_configuration: Option<&'a str>,
1414
#[serde(skip_serializing_if = "Option::is_none")]
1515
pub release_notes: Option<&'a str>,
16+
#[serde(skip_serializing_if = "<[_]>::is_empty")]
17+
pub install_groups: &'a [String],
1618
#[serde(flatten)]
1719
pub vcs_info: &'a VcsInfo<'a>,
1820
}

src/commands/build/upload.rs

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ pub fn make_command(command: Command) -> Command {
106106
.long("release-notes")
107107
.help("The release notes to use for the upload.")
108108
)
109+
.arg(
110+
Arg::new("install_group")
111+
.long("install-group")
112+
.action(ArgAction::Append)
113+
.help(
114+
"The install group(s) for this build. Can be specified multiple times. \
115+
Builds with at least one matching install group will be shown updates \
116+
for each other.",
117+
)
118+
)
109119
.arg(
110120
Arg::new("force_git_metadata")
111121
.long("force-git-metadata")
@@ -175,6 +185,10 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
175185

176186
let build_configuration = matches.get_one("build_configuration").map(String::as_str);
177187
let release_notes = matches.get_one("release_notes").map(String::as_str);
188+
let install_groups: Vec<String> = matches
189+
.get_many("install_group")
190+
.map(|vals| vals.cloned().collect())
191+
.unwrap_or_default();
178192

179193
let (plugin_name, plugin_version) = parse_plugin_from_pipeline(config.get_pipeline_env());
180194

@@ -237,15 +251,13 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
237251
for (path, zip) in normalized_zips {
238252
info!("Uploading file: {}", path.display());
239253
let bytes = ByteView::open(zip.path())?;
240-
match upload_file(
241-
&authenticated_api,
242-
&bytes,
243-
&org,
244-
&project,
254+
let metadata = BuildMetadata {
245255
build_configuration,
246256
release_notes,
247-
&vcs_info,
248-
) {
257+
install_groups: &install_groups,
258+
vcs_info: &vcs_info,
259+
};
260+
match upload_file(&authenticated_api, &bytes, &org, &project, &metadata) {
249261
Ok(artifact_url) => {
250262
info!("Successfully uploaded file: {}", path.display());
251263
uploaded_paths_and_urls.push((path.to_path_buf(), artifact_url));
@@ -588,19 +600,27 @@ fn handle_directory(
588600
normalize_directory(path, temp_dir.path(), plugin_name, plugin_version)
589601
}
590602

603+
/// Metadata for a build upload.
604+
struct BuildMetadata<'a> {
605+
build_configuration: Option<&'a str>,
606+
release_notes: Option<&'a str>,
607+
install_groups: &'a [String],
608+
vcs_info: &'a VcsInfo<'a>,
609+
}
610+
591611
/// Returns artifact url if upload was successful.
592612
fn upload_file(
593613
api: &AuthenticatedApi,
594614
bytes: &[u8],
595615
org: &str,
596616
project: &str,
597-
build_configuration: Option<&str>,
598-
release_notes: Option<&str>,
599-
vcs_info: &VcsInfo<'_>,
617+
metadata: &BuildMetadata<'_>,
600618
) -> Result<String> {
601619
debug!(
602-
"Uploading file to organization: {org}, project: {project}, build_configuration: {}, vcs_info: {vcs_info:?}",
603-
build_configuration.unwrap_or("unknown"),
620+
"Uploading file to organization: {org}, project: {project}, build_configuration: {}, install_groups: {:?}, vcs_info: {:?}",
621+
metadata.build_configuration.unwrap_or("unknown"),
622+
metadata.install_groups,
623+
metadata.vcs_info,
604624
);
605625

606626
let chunk_upload_options = api.get_chunk_upload_options(org)?;
@@ -641,9 +661,10 @@ fn upload_file(
641661
&ChunkedBuildRequest {
642662
checksum,
643663
chunks: &checksums,
644-
build_configuration,
645-
release_notes,
646-
vcs_info,
664+
build_configuration: metadata.build_configuration,
665+
release_notes: metadata.release_notes,
666+
install_groups: metadata.install_groups,
667+
vcs_info: metadata.vcs_info,
647668
},
648669
)?;
649670
chunks.retain(|Chunk((digest, _))| response.missing_chunks.contains(digest));

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ Options:
7474
--release-notes <release_notes>
7575
The release notes to use for the upload.
7676

77+
--install-group <install_group>
78+
The install group(s) for this build. Can be specified multiple times. Builds with at least
79+
one matching install group will be shown updates for each other.
80+
7781
--force-git-metadata
7882
Force collection and sending of git metadata (branch, commit, etc.). If neither this nor
7983
--no-git-metadata is specified, git metadata is automatically collected when running in

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ Options:
7373
--release-notes <release_notes>
7474
The release notes to use for the upload.
7575

76+
--install-group <install_group>
77+
The install group(s) for this build. Can be specified multiple times. Builds with at least
78+
one matching install group will be shown updates for each other.
79+
7680
--force-git-metadata
7781
Force collection and sending of git metadata (branch, commit, etc.). If neither this nor
7882
--no-git-metadata is specified, git metadata is automatically collected when running in

0 commit comments

Comments
 (0)