Skip to content

Commit 7142e31

Browse files
committed
feat(build): Add --date-built parameter for artifact uploads (EME-631)
Add support for passing build timestamps when uploading Android artifacts via the build upload command. This allows the sentry-android-gradle-plugin to capture the build time and send it to Sentry. Changes: - Add --date-built CLI argument to build upload command - Add date_built field to ChunkedBuildRequest struct - Pass date_built through upload_file function to API - Update help text with ISO 8601 format example - Update test snapshots
1 parent 773d45e commit 7142e31

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/api/data_types/chunking/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ pub struct ChunkedBuildRequest<'a> {
1111
pub build_configuration: Option<&'a str>,
1212
#[serde(skip_serializing_if = "Option::is_none")]
1313
pub release_notes: Option<&'a str>,
14+
#[serde(skip_serializing_if = "Option::is_none")]
15+
pub date_built: Option<&'a str>,
1416
#[serde(flatten)]
1517
pub vcs_info: &'a VcsInfo<'a>,
1618
}

src/commands/build/upload.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ pub fn make_command(command: Command) -> Command {
107107
.long("release-notes")
108108
.help("The release notes to use for the upload.")
109109
)
110+
.arg(
111+
Arg::new("date_built")
112+
.long("date-built")
113+
.help("The date and time when the build was created (ISO 8601 format with timezone, e.g., '2025-11-26T10:30:00Z')")
114+
)
110115
.arg(
111116
Arg::new("git_metadata")
112117
.long("git-metadata")
@@ -162,6 +167,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
162167

163168
let build_configuration = matches.get_one("build_configuration").map(String::as_str);
164169
let release_notes = matches.get_one("release_notes").map(String::as_str);
170+
let date_built = matches.get_one("date_built").map(String::as_str);
165171

166172
let api = Api::current();
167173
let authenticated_api = api.authenticated()?;
@@ -232,6 +238,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
232238
&project,
233239
build_configuration,
234240
release_notes,
241+
date_built,
235242
&vcs_info,
236243
) {
237244
Ok(artifact_url) => {
@@ -617,6 +624,7 @@ fn upload_file(
617624
project: &str,
618625
build_configuration: Option<&str>,
619626
release_notes: Option<&str>,
627+
date_built: Option<&str>,
620628
vcs_info: &VcsInfo<'_>,
621629
) -> Result<String> {
622630
const SELF_HOSTED_ERROR_HINT: &str = "If you are using a self-hosted Sentry server, \
@@ -679,6 +687,7 @@ fn upload_file(
679687
chunks: &checksums,
680688
build_configuration,
681689
release_notes,
690+
date_built,
682691
vcs_info,
683692
},
684693
)?;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ Options:
5353
be used.
5454
--release-notes <release_notes>
5555
The release notes to use for the upload.
56+
--date-built <date_built>
57+
The date and time when the build was created (ISO 8601 format with timezone, e.g.,
58+
'2025-11-26T10:30:00Z')
5659
--git-metadata [<git_metadata>]
5760
Controls whether to collect and send git metadata (branch, commit, etc.). Use
5861
--git-metadata to force enable, --git-metadata=false to force disable. If not specified,

0 commit comments

Comments
 (0)