From 98693ae51621b4003998050532c4a34773d4aefc Mon Sep 17 00:00:00 2001 From: Dylan Frankland Date: Fri, 12 Jun 2026 13:29:13 -0700 Subject: [PATCH 1/2] Rename --test-collection-short-id flag to --test-collection-id Co-Authored-By: Claude Sonnet 4.6 --- .github/actions/perform_smoke_test/action.yaml | 6 +++--- .github/workflows/pull_request.yml | 2 +- cli/src/upload_command.rs | 4 ++-- cli/tests/upload.rs | 9 +++------ constants/src/lib.rs | 2 +- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/actions/perform_smoke_test/action.yaml b/.github/actions/perform_smoke_test/action.yaml index c7e90535..90e5cd93 100644 --- a/.github/actions/perform_smoke_test/action.yaml +++ b/.github/actions/perform_smoke_test/action.yaml @@ -91,7 +91,7 @@ runs: --xcresult-path smoke-test/swift/TestResults.xcresult \ --token ${{ inputs.staging-api-token }} \ --test-process-exit-code $EXIT_CODE \ - --test-collection-short-id z2dzjLHm + --test-collection-id z2dzjLHm env: TRUNK_PUBLIC_API_ADDRESS: https://api.trunk-staging.io @@ -106,7 +106,7 @@ runs: --org-url-slug trunk-staging-org \ --junit-paths "${{ github.workspace }}/target/**/*junit.xml" \ --token ${{ inputs.staging-api-token }} \ - --test-collection-short-id z2dzjLHm + --test-collection-id z2dzjLHm - name: Upload to staging with public repo id id: staging-upload-public-repo-id @@ -139,7 +139,7 @@ runs: --junit-paths "${{ github.workspace }}/target/**/*junit.xml" \ --token ${{ inputs.staging-api-token }} \ --variant smoke-test-variant \ - --test-collection-short-id z2dzjLHm + --test-collection-id z2dzjLHm EXIT_CODE=$? if [ $EXIT_CODE -eq 0 ]; then echo "ERROR: Expected upload with variant to fail, but it succeeded" diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 89f18484..e5c7a008 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -205,7 +205,7 @@ jobs: --org-url-slug trunk-staging-org \ --token ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }} \ --test-process-exit-code ${{ steps.extract.outputs.test-step-outcome }} \ - --test-collection-short-id 2tYJWMu7 + --test-collection-id 2tYJWMu7 - name: Upload results to prod using built CLI shell: bash diff --git a/cli/src/upload_command.rs b/cli/src/upload_command.rs index 4b223c69..858f82f8 100644 --- a/cli/src/upload_command.rs +++ b/cli/src/upload_command.rs @@ -72,9 +72,9 @@ pub struct UploadArgs { #[arg(long, env = constants::TRUNK_ORG_URL_SLUG_ENV, help = "Organization url slug.")] pub org_url_slug: String, #[arg( - long, + long = "test-collection-id", env = constants::TRUNK_TEST_COLLECTION_SHORT_ID_ENV, - help = "Optional test collection short ID to attach to the uploaded bundle for collection-aware ingestion.", + help = "Optional 8 character alphanumeric ID for a test collection.", required = false, num_args = 1 )] diff --git a/cli/tests/upload.rs b/cli/tests/upload.rs index 7aac5291..239cdd45 100644 --- a/cli/tests/upload.rs +++ b/cli/tests/upload.rs @@ -59,7 +59,7 @@ async fn upload_bundle() { let assert = command_builder .command() .env("GITHUB_EXTERNAL_ID", "test-external-id-123") - .arg("--test-collection-short-id") + .arg("--test-collection-id") .arg("tc_123") .assert() // should fail due to quarantine and succeed without quarantining @@ -237,10 +237,7 @@ async fn upload_bundle() { assert_eq!(test_case_run.codeowners[1].name, "@user2"); let mut expected_command_args = command_builder.build_args(); - expected_command_args.extend([ - String::from("--test-collection-short-id"), - String::from("tc_123"), - ]); + expected_command_args.extend([String::from("--test-collection-id"), String::from("tc_123")]); assert!( debug_props.command_line.ends_with( &expected_command_args @@ -530,7 +527,7 @@ async fn upload_bundle_without_canonical_test_collection_metadata_keeps_bundle_g CommandBuilder::upload(temp_dir.path(), state.host.clone()) .command() - .arg("--test-collection-short-id") + .arg("--test-collection-id") .arg("tc_123") .assert() .failure(); diff --git a/constants/src/lib.rs b/constants/src/lib.rs index 781b0645..3158bc0e 100644 --- a/constants/src/lib.rs +++ b/constants/src/lib.rs @@ -29,7 +29,7 @@ pub const TRUNK_API_CLIENT_RETRY_COUNT_ENV: &str = "TRUNK_API_CLIENT_RETRY_COUNT pub const TRUNK_API_TOKEN_ENV: &str = "TRUNK_API_TOKEN"; pub const TRUNK_PUBLIC_REPO_ID_ENV: &str = "TRUNK_PUBLIC_REPO_ID"; pub const TRUNK_ORG_URL_SLUG_ENV: &str = "TRUNK_ORG_URL_SLUG"; -pub const TRUNK_TEST_COLLECTION_SHORT_ID_ENV: &str = "TRUNK_TEST_COLLECTION_SHORT_ID"; +pub const TRUNK_TEST_COLLECTION_SHORT_ID_ENV: &str = "TRUNK_TEST_COLLECTION_ID"; pub const TRUNK_REPO_ROOT_ENV: &str = "TRUNK_REPO_ROOT"; pub const TRUNK_REPO_URL_ENV: &str = "TRUNK_REPO_URL"; pub const TRUNK_REPO_HEAD_SHA_ENV: &str = "TRUNK_REPO_HEAD_SHA"; From da45249e77bf3fe536674420fd897c73149763f9 Mon Sep 17 00:00:00 2001 From: Dylan Frankland Date: Fri, 12 Jun 2026 15:45:20 -0700 Subject: [PATCH 2/2] Add test collection ID support to Ruby gem and CI workflows - Rename TRUNK_TEST_COLLECTION_SHORT_ID_ENV constant to TRUNK_TEST_COLLECTION_ID_ENV - Read TRUNK_TEST_COLLECTION_ID env var in Ruby gem publish - Add test-collection-id input to test_ruby_gem_uploads action - Wire staging (T5yKSn9h) and prod (BiBP2neA) collection IDs into workflows Co-Authored-By: Claude Sonnet 4.6 --- .github/actions/test_ruby_gem_uploads/action.yaml | 6 ++++++ .github/workflows/release_ruby_gem.yml | 1 + .github/workflows/ruby.yml | 1 + .github/workflows/smoke_test.yml | 2 ++ .github/workflows/smoke_test_main.yml | 2 ++ cli/src/upload_command.rs | 2 +- constants/src/lib.rs | 4 ++-- rspec-trunk-flaky-tests/lib/trunk_spec_helper.rb | 1 + test_report/src/report.rs | 2 ++ 9 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/actions/test_ruby_gem_uploads/action.yaml b/.github/actions/test_ruby_gem_uploads/action.yaml index 23a418b2..41a9e4af 100644 --- a/.github/actions/test_ruby_gem_uploads/action.yaml +++ b/.github/actions/test_ruby_gem_uploads/action.yaml @@ -24,6 +24,9 @@ inputs: platform: description: The platform that the gem was built for required: true + test-collection-id: + description: Optional 8 character alphanumeric ID for a test collection + required: false knapsack-pro-test-suite-token-rspec: description: Optional Knapsack Pro test suite token for RSpec required: true @@ -83,6 +86,7 @@ runs: TRUNK_PUBLIC_API_ADDRESS: ${{ inputs.trunk-public-api-address }} TRUNK_ORG_URL_SLUG: ${{ inputs.trunk-org-slug }} TRUNK_API_TOKEN: ${{ inputs.trunk-token }} + TRUNK_TEST_COLLECTION_ID: ${{ inputs.test-collection-id }} - name: Run variant quarantine test without variant (should fail - not quarantined) id: run-variant-test-no-variant @@ -102,6 +106,7 @@ runs: TRUNK_PUBLIC_API_ADDRESS: ${{ inputs.trunk-public-api-address }} TRUNK_ORG_URL_SLUG: ${{ inputs.trunk-org-slug }} TRUNK_API_TOKEN: ${{ inputs.trunk-token }} + TRUNK_TEST_COLLECTION_ID: ${{ inputs.test-collection-id }} TRUNK_VARIANT: "" - name: Run variant quarantine test with variant (should pass - quarantined) @@ -122,6 +127,7 @@ runs: TRUNK_PUBLIC_API_ADDRESS: ${{ inputs.trunk-public-api-address }} TRUNK_ORG_URL_SLUG: ${{ inputs.trunk-org-slug }} TRUNK_API_TOKEN: ${{ inputs.trunk-token }} + TRUNK_TEST_COLLECTION_ID: ${{ inputs.test-collection-id }} TRUNK_VARIANT: smoke-test-variant - name: Run quarantine lookup failure abort test (should fail fast, skip slow_test) diff --git a/.github/workflows/release_ruby_gem.yml b/.github/workflows/release_ruby_gem.yml index e329ca0c..b17096ca 100644 --- a/.github/workflows/release_ruby_gem.yml +++ b/.github/workflows/release_ruby_gem.yml @@ -132,6 +132,7 @@ jobs: with: ruby-version: ${{ matrix.ruby-version }} trunk-token: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }} + test-collection-id: T5yKSn9h platform: ${{ matrix.platform.name }} artifact-pattern: cross-gem-${{ matrix.platform.name }} knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }} diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index ea6b39b5..ac0d4653 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -118,6 +118,7 @@ jobs: trunk-token: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }} trunk-public-api-address: https://api.trunk-staging.io trunk-org-slug: trunk-staging-org + test-collection-id: T5yKSn9h platform: x86_64-linux artifact-pattern: "" knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }} diff --git a/.github/workflows/smoke_test.yml b/.github/workflows/smoke_test.yml index 73b4859b..fa14b9be 100644 --- a/.github/workflows/smoke_test.yml +++ b/.github/workflows/smoke_test.yml @@ -173,6 +173,7 @@ jobs: trunk-token: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }} trunk-public-api-address: https://api.trunk-staging.io trunk-org-slug: trunk-staging-org + test-collection-id: T5yKSn9h platform: x86_64-linux artifact-pattern: "" knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }} @@ -198,6 +199,7 @@ jobs: trunk-token: ${{ secrets.TRUNK_PROD_ORG_API_TOKEN }} trunk-public-api-address: https://api.trunk.io trunk-org-slug: trunk + test-collection-id: BiBP2neA platform: x86_64-linux artifact-pattern: "" knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }} diff --git a/.github/workflows/smoke_test_main.yml b/.github/workflows/smoke_test_main.yml index 0ff067bf..b0180845 100644 --- a/.github/workflows/smoke_test_main.yml +++ b/.github/workflows/smoke_test_main.yml @@ -226,6 +226,7 @@ jobs: trunk-token: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }} trunk-public-api-address: https://api.trunk-staging.io trunk-org-slug: trunk-staging-org + test-collection-id: T5yKSn9h platform: x86_64-linux artifact-pattern: "" knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }} @@ -251,6 +252,7 @@ jobs: trunk-token: ${{ secrets.TRUNK_PROD_ORG_API_TOKEN }} trunk-public-api-address: https://api.trunk.io trunk-org-slug: trunk + test-collection-id: BiBP2neA platform: x86_64-linux artifact-pattern: "" knapsack-pro-test-suite-token-rspec: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }} diff --git a/cli/src/upload_command.rs b/cli/src/upload_command.rs index 858f82f8..2e75e329 100644 --- a/cli/src/upload_command.rs +++ b/cli/src/upload_command.rs @@ -73,7 +73,7 @@ pub struct UploadArgs { pub org_url_slug: String, #[arg( long = "test-collection-id", - env = constants::TRUNK_TEST_COLLECTION_SHORT_ID_ENV, + env = constants::TRUNK_TEST_COLLECTION_ID_ENV, help = "Optional 8 character alphanumeric ID for a test collection.", required = false, num_args = 1 diff --git a/constants/src/lib.rs b/constants/src/lib.rs index 3158bc0e..79885540 100644 --- a/constants/src/lib.rs +++ b/constants/src/lib.rs @@ -29,7 +29,7 @@ pub const TRUNK_API_CLIENT_RETRY_COUNT_ENV: &str = "TRUNK_API_CLIENT_RETRY_COUNT pub const TRUNK_API_TOKEN_ENV: &str = "TRUNK_API_TOKEN"; pub const TRUNK_PUBLIC_REPO_ID_ENV: &str = "TRUNK_PUBLIC_REPO_ID"; pub const TRUNK_ORG_URL_SLUG_ENV: &str = "TRUNK_ORG_URL_SLUG"; -pub const TRUNK_TEST_COLLECTION_SHORT_ID_ENV: &str = "TRUNK_TEST_COLLECTION_ID"; +pub const TRUNK_TEST_COLLECTION_ID_ENV: &str = "TRUNK_TEST_COLLECTION_ID"; pub const TRUNK_REPO_ROOT_ENV: &str = "TRUNK_REPO_ROOT"; pub const TRUNK_REPO_URL_ENV: &str = "TRUNK_REPO_URL"; pub const TRUNK_REPO_HEAD_SHA_ENV: &str = "TRUNK_REPO_HEAD_SHA"; @@ -63,7 +63,7 @@ pub const TRUNK_ENVS_TO_CAPTURE: &[&str] = &[ TRUNK_API_CLIENT_RETRY_COUNT_ENV, TRUNK_PUBLIC_REPO_ID_ENV, TRUNK_ORG_URL_SLUG_ENV, - TRUNK_TEST_COLLECTION_SHORT_ID_ENV, + TRUNK_TEST_COLLECTION_ID_ENV, TRUNK_REPO_ROOT_ENV, TRUNK_REPO_URL_ENV, TRUNK_REPO_HEAD_SHA_ENV, diff --git a/rspec-trunk-flaky-tests/lib/trunk_spec_helper.rb b/rspec-trunk-flaky-tests/lib/trunk_spec_helper.rb index 1b6f5a89..a691f638 100644 --- a/rspec-trunk-flaky-tests/lib/trunk_spec_helper.rb +++ b/rspec-trunk-flaky-tests/lib/trunk_spec_helper.rb @@ -20,6 +20,7 @@ # # Optional environment variables for configuration: # TRUNK_CODEOWNERS_PATH - Path to CODEOWNERS file +# TRUNK_TEST_COLLECTION_ID - Optional 8 character alphanumeric ID for a test collection # TRUNK_VARIANT - Variant name for test results (e.g., 'linux', 'pr-123') # TRUNK_DISABLE_QUARANTINING - Set to 'true' to disable quarantining # TRUNK_ALLOW_EMPTY_TEST_RESULTS - Set to 'true' to allow empty results diff --git a/test_report/src/report.rs b/test_report/src/report.rs index 81efae5c..5212bf0c 100644 --- a/test_report/src/report.rs +++ b/test_report/src/report.rs @@ -696,6 +696,8 @@ impl MutTestReport { upload_args.pr_number = env::var(constants::TRUNK_PR_NUMBER_ENV) .ok() .and_then(|v| v.parse::().ok()); + upload_args.test_collection_short_id = + env::var(constants::TRUNK_TEST_COLLECTION_ID_ENV).ok(); let debug_props = BundleMetaDebugProps { command_line: self.0.borrow().command.clone(), trunk_envs: HashMap::new(),