Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ pub struct CreateBundleUploadRequest {
pub client_version: String,
#[serde(rename = "remoteUrls")]
pub remote_urls: Vec<String>,
#[serde(rename = "externalId")]
pub external_id: Option<String>,
}

#[derive(Debug, Serialize, Clone, Deserialize)]
Expand Down
2 changes: 2 additions & 0 deletions cli-tests/src/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ async fn upload_bundle() {

let assert = command_builder
.command()
.env("GITHUB_EXTERNAL_ID", "test-external-id-123")
.assert()
// should fail due to quarantine and succeed without quarantining
.failure();
Expand Down Expand Up @@ -94,6 +95,7 @@ async fn upload_bundle() {
.starts_with("trunk-analytics-cli cargo="));
assert!(upload_request.client_version.contains(" git="));
assert!(upload_request.client_version.contains(" rustc="));
assert!(upload_request.external_id.is_some());

let tar_extract_directory =
assert_matches!(requests_iter.next().unwrap(), RequestPayload::S3Upload(d) => d);
Expand Down
2 changes: 2 additions & 0 deletions cli/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -706,12 +706,14 @@ pub async fn gather_upload_id_context(
if dry_run {
return Err(anyhow::anyhow!("Dry run mode enabled, unable to upload"));
}
let external_id = meta.base_props.envs.get("GITHUB_EXTERNAL_ID").cloned();
let upload = api_client
.create_bundle_upload(&api::message::CreateBundleUploadRequest {
repo: meta.base_props.repo.repo.clone(),
org_url_slug: meta.base_props.org.clone(),
client_version: format!("trunk-analytics-cli {}", meta.base_props.cli_version),
remote_urls: vec![meta.base_props.repo.repo_url.clone()],
external_id,
})
.await?;
meta.base_props.bundle_upload_id.clone_from(&upload.id);
Expand Down
Loading