Skip to content

Commit

Permalink
[chore] Fix integration tests workflow to validate SHAs match (#1282)
Browse files Browse the repository at this point in the history
  • Loading branch information
jefchien authored Aug 8, 2024
1 parent eaceb82 commit c3f1e5f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/application-signals-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,31 @@ on:
description: 'The ID of the build-test-artifacts workflow run'
type: number
required: true
build_sha:
description: 'The SHA of the build-test-artifacts workflow run'
type: string
required: true

permissions:
id-token: write
contents: read

concurrency:
group: '${{ github.workflow }} @ ${{ inputs.aws-region }}'
cancel-in-progress: false
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true


jobs:
CheckBuildTestArtifacts:
runs-on: ubuntu-latest
steps:
- run: |
if [[ ${{ inputs.build_sha }} == ${{ github.sha }} ]]; then
echo "Build SHA matches test SHA"
else
echo "Build SHA does not match test SHA"
exit 1
fi
- run: |
conclusion=$(gh run view ${{ inputs.build_run_id }} --repo $GITHUB_REPOSITORY --json conclusion -q '.conclusion')
if [[ $conclusion == "success" ]]; then
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/build-test-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ on:
paths-ignore:
- '**/*.md'
- 'NOTICE'
- 'RELEASE_NOTES'
- 'THIRD-PARTY'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/build-test-artifacts.yml'
- '!.github/workflows/integration-test.yml'
- '!.github/workflows/application-signals-e2e-test.yml'
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -88,14 +89,16 @@ jobs:
needs: [ BuildAndUploadPackages, BuildAndUploadITAR, BuildAndUploadCN, BuildDocker ]
runs-on: ubuntu-latest
steps:
- run: gh workflow run integration-test.yml --ref ${{ github.ref_name }} --repo $GITHUB_REPOSITORY -f build_run_id=${{ github.run_id }}
- run: gh workflow run integration-test.yml --ref ${{ github.ref_name }} --repo $GITHUB_REPOSITORY -f build_run_id=${{ github.run_id }} -f build_sha=${{ github.sha }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

StartApplicationSignalsE2ETests:
needs: [ BuildAndUpload, BuildDocker ]
needs: [ BuildAndUploadPackages, BuildAndUploadITAR, BuildAndUploadCN, BuildDocker ]
# Workflow only runs against main
if: ${{ contains(github.ref_name, 'main') }}
runs-on: ubuntu-latest
steps:
- run: gh workflow run application-signals-e2e-test.yml --ref ${{ github.ref_name }} --repo $GITHUB_REPOSITORY -f build_run_id=${{ github.run_id }}
- run: gh workflow run application-signals-e2e-test.yml --ref ${{ github.ref_name }} --repo $GITHUB_REPOSITORY -f build_run_id=${{ github.run_id }} -f build_sha=${{ github.sha }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ on:
description: 'The ID of the build-test-artifacts workflow run'
type: number
required: true
build_sha:
description: 'The SHA of the build-test-artifacts workflow run'
type: string
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
Expand All @@ -35,6 +39,13 @@ jobs:
CheckBuildTestArtifacts:
runs-on: ubuntu-latest
steps:
- run: |
if [[ ${{ inputs.build_sha }} == ${{ github.sha }} ]]; then
echo "Build SHA matches test SHA"
else
echo "Build SHA does not match test SHA"
exit 1
fi
- run: |
conclusion=$(gh run view ${{ inputs.build_run_id }} --repo $GITHUB_REPOSITORY --json conclusion -q '.conclusion')
if [[ $conclusion == "success" ]]; then
Expand Down

0 comments on commit c3f1e5f

Please sign in to comment.