From 3e9873f6c485d121c75df69640fc12bb91fbba8a Mon Sep 17 00:00:00 2001 From: ichengchang <50877414+ichengchang@users.noreply.github.com> Date: Wed, 1 May 2024 15:04:20 -0400 Subject: [PATCH] Resolve race condition and related timing issues. (#1409) --- .github/workflows/tag.yml | 22 +++++++++++++-------- .github/workflows/verify_consumer_pacts.yml | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 42b9e5363..8a91e5cdf 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -13,11 +13,6 @@ on: default: false required: false type: string - print-tag: - description: "Echo generated tag to console" - default: "true" - required: false - type: string release-branches: description: "Default branch (main, develop, etc)" default: 'main' @@ -30,6 +25,9 @@ on: new-tag: description: "The value of the newly created tag" value: ${{ jobs.tag-job.outputs.new-tag }} + app-version: + description: "The app version" + value: ${{ jobs.tag-job.outputs.app-version }} secrets: BROADBOT_TOKEN: required: true @@ -44,6 +42,7 @@ jobs: outputs: tag: ${{ steps.tag.outputs.tag }} new-tag: ${{ steps.tag.outputs.new_tag }} + app-version: ${{ steps.output-version.outputs.app-version }} steps: - name: Checkout current code uses: actions/checkout@v3 @@ -60,7 +59,14 @@ jobs: DRY_RUN: ${{ inputs.dry-run }} RELEASE_BRANCHES: ${{ inputs.release-branches }} WITH_V: true - - name: Echo generated tag to console - if: ${{ inputs.print-tag == 'true' }} + - name: Output app version + id: output-version run: | - echo "Newly created version tag: '${{ steps.tag.outputs.new_tag }}'" + # See https://broadworkbench.atlassian.net/browse/QA-2282 for context + if [[ -z "${{ steps.tag.outputs.new_tag }}" ]]; then + echo "App version tag for this commit has already been dispatched: '${{ steps.tag.outputs.tag }}'" + echo "app-version=${{ steps.tag.outputs.tag }}" >> $GITHUB_OUTPUT + else + echo "New app version tag: '${{ steps.tag.outputs.new_tag }}'" + echo "app-version=${{ steps.tag.outputs.new_tag }}" >> $GITHUB_OUTPUT + fi diff --git a/.github/workflows/verify_consumer_pacts.yml b/.github/workflows/verify_consumer_pacts.yml index c7c54b6ee..29935e8f3 100644 --- a/.github/workflows/verify_consumer_pacts.yml +++ b/.github/workflows/verify_consumer_pacts.yml @@ -151,7 +151,7 @@ jobs: # for publishing the results of provider verification. if [[ -z "${{ inputs.pb-event-type }}" ]]; then echo "PROVIDER_BRANCH=${{ env.CURRENT_BRANCH }}" >> $GITHUB_ENV - echo "PROVIDER_VERSION=${{ needs.regulated-tag-job.outputs.new-tag }}" >> $GITHUB_ENV + echo "PROVIDER_VERSION=${{ needs.regulated-tag-job.outputs.app-version }}" >> $GITHUB_ENV else echo "PROVIDER_VERSION=${{ env.PROVIDER_TAG }}" >> $GITHUB_ENV fi