From e5cedf43a58459156ac457c392886c8fc48c9cef Mon Sep 17 00:00:00 2001 From: Tyler Jang Date: Tue, 17 Nov 2026 15:03:52 +0000 Subject: [PATCH] ci(smoke-test): pick the token by the release under test (TRUNK-23149) #1314 moved the release smoke test to the v2 API keys, but it runs the latest published CLI and gem (0.17.0), which send --token as an organization token. trunk1 finds no org for a v2 key, so createBundleUpload and the quarantine lookup 404 on staging and production. determine_releases now records whether each release is 1.0.0 or later. Releases before 1.0.0 get the organization token, and later ones get the v2 key, so the run switches over when 1.0.0 is published. The gem jobs now list determine_releases in needs so they can read that output. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/smoke_test.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/smoke_test.yml b/.github/workflows/smoke_test.yml index 3fff5e6e..5f6f2893 100644 --- a/.github/workflows/smoke_test.yml +++ b/.github/workflows/smoke_test.yml @@ -24,6 +24,8 @@ jobs: outputs: release: ${{ steps.set-releases.outputs.release }} rspec_release: ${{ steps.set-releases.outputs.rspec_release }} + cli_v2: ${{ steps.set-releases.outputs.cli_v2 }} + rspec_v2: ${{ steps.set-releases.outputs.rspec_v2 }} steps: - name: Get Latest Release id: get-latest-release @@ -58,6 +60,11 @@ jobs: echo "release=$RELEASE" >> $GITHUB_OUTPUT echo "rspec_release=$RSPEC_RELEASE" >> $GITHUB_OUTPUT + + # Releases before 1.0.0 read --token only as an organization token. + major() { echo "${1#v}" | cut -d. -f1; } + echo "cli_v2=$([ "$(major "$RELEASE")" -ge 1 ] && echo true || echo false)" >> "$GITHUB_OUTPUT" + echo "rspec_v2=$([ "$(major "$RSPEC_RELEASE")" -ge 1 ] && echo true || echo false)" >> "$GITHUB_OUTPUT" echo "Using RELEASE: $RELEASE" echo "Using RSPEC_RELEASE: $RSPEC_RELEASE" build_cli: @@ -122,8 +129,8 @@ jobs: uses: ./.github/actions/perform_smoke_test with: cli-binary-location: ${{ matrix.platform.binary-name }} - staging-api-token: ${{ secrets.TRUNK_STAGING_API_V2_TOKEN }} - production-api-token: ${{ secrets.TRUNK_PROD_API_V2_TOKEN }} + staging-api-token: ${{ needs.determine_releases.outputs.cli_v2 == 'true' && secrets.TRUNK_STAGING_API_V2_TOKEN || secrets.TRUNK_STAGING_ORG_API_TOKEN }} + production-api-token: ${{ needs.determine_releases.outputs.cli_v2 == 'true' && secrets.TRUNK_PROD_API_V2_TOKEN || secrets.TRUNK_PROD_ORG_API_TOKEN }} environment-type: ${{ (github.event.action == 'production-release' && 'production') || (github.event.action == 'staging-release' && 'staging') || 'both' }} download_ruby_gem: @@ -155,7 +162,7 @@ jobs: test_ruby_gem_staging: name: Test Ruby gem on staging runs-on: ubuntu-latest - needs: download_ruby_gem + needs: [determine_releases, download_ruby_gem] steps: - name: Checkout uses: actions/checkout@v4 @@ -170,7 +177,7 @@ jobs: uses: ./.github/actions/test_ruby_gem_uploads with: ruby-version: "3.4" - trunk-token: ${{ secrets.TRUNK_STAGING_API_V2_TOKEN }} + trunk-token: ${{ needs.determine_releases.outputs.rspec_v2 == 'true' && secrets.TRUNK_STAGING_API_V2_TOKEN || secrets.TRUNK_STAGING_ORG_API_TOKEN }} trunk-public-api-address: https://api.trunk-staging.io trunk-org-slug: trunk-staging-org # analytics-cli-ruby-gem: https://app.trunk-staging.io/trunk-staging-org/flaky-tests/collections/T5yKSn9h/monitors @@ -182,7 +189,7 @@ jobs: test_ruby_gem_production: name: Test Ruby gem on production runs-on: ubuntu-latest - needs: download_ruby_gem + needs: [determine_releases, download_ruby_gem] steps: - name: Checkout uses: actions/checkout@v4 @@ -197,7 +204,7 @@ jobs: uses: ./.github/actions/test_ruby_gem_uploads with: ruby-version: "3.4" - trunk-token: ${{ secrets.TRUNK_PROD_API_V2_TOKEN }} + trunk-token: ${{ needs.determine_releases.outputs.rspec_v2 == 'true' && secrets.TRUNK_PROD_API_V2_TOKEN || secrets.TRUNK_PROD_ORG_API_TOKEN }} trunk-public-api-address: https://api.trunk.io trunk-org-slug: trunk # analytics-cli-ruby-gem: https://app.trunk.io/trunk/flaky-tests/collections/BiBP2neA/monitors