From 5751abaaaf2813fef98aec11ea6946fd963d3cad Mon Sep 17 00:00:00 2001 From: Jeffrey Chien Date: Fri, 2 Aug 2024 18:28:07 -0400 Subject: [PATCH 1/3] Separate build jobs for artifacts and trigger tests with workflow_run. --- .../application-signals-e2e-test.yml | 25 +++- .github/workflows/build-test-artifacts.yml | 85 +++++++++++ .github/workflows/integration-test.yml | 136 ++++-------------- 3 files changed, 133 insertions(+), 113 deletions(-) create mode 100644 .github/workflows/build-test-artifacts.yml diff --git a/.github/workflows/application-signals-e2e-test.yml b/.github/workflows/application-signals-e2e-test.yml index 53035bc3b3..d01264d29b 100644 --- a/.github/workflows/application-signals-e2e-test.yml +++ b/.github/workflows/application-signals-e2e-test.yml @@ -4,9 +4,12 @@ # This is a reusable workflow for running the E2E test for Application Signals. # It is meant to be called from another workflow. # Read more about reusable workflows: https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview -name: E2E Testing +name: Application Signals E2E Test on: - workflow_call: + workflow_run: + workflows: [ Build Test Artifacts ] + types: + - completed permissions: id-token: write @@ -18,7 +21,14 @@ concurrency: jobs: + CheckBuildTestArtifacts: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - run: echo 'The triggering build workflow succeeded' + java-eks-e2e-test: + needs: CheckBuildTestArtifacts uses: aws-observability/aws-application-signals-test-framework/.github/workflows/java-eks-e2e-test.yml@main secrets: inherit with: @@ -27,6 +37,7 @@ jobs: caller-workflow-name: 'main-build' java-ec2-default-e2e-test: + needs: CheckBuildTestArtifacts uses: aws-observability/aws-application-signals-test-framework/.github/workflows/java-ec2-default-e2e-test.yml@main secrets: inherit with: @@ -34,6 +45,7 @@ jobs: caller-workflow-name: 'main-build' java-ec2-asg-e2e-test: + needs: [ CheckBuildTestArtifacts ] uses: aws-observability/aws-application-signals-test-framework/.github/workflows/java-ec2-asg-e2e-test.yml@main secrets: inherit with: @@ -41,7 +53,7 @@ jobs: caller-workflow-name: 'main-build' java-metric-limiter-e2e-test: - needs: [ java-eks-e2e-test ] + needs: [ CheckBuildTestArtifacts, java-eks-e2e-test ] uses: aws-observability/aws-application-signals-test-framework/.github/workflows/java-metric-limiter-e2e-test.yml@main secrets: inherit with: @@ -50,6 +62,7 @@ jobs: caller-workflow-name: 'main-build' java-k8s-e2e-test: + needs: [ CheckBuildTestArtifacts ] uses: aws-observability/aws-application-signals-test-framework/.github/workflows/java-k8s-e2e-test.yml@main secrets: inherit with: @@ -57,7 +70,7 @@ jobs: caller-workflow-name: 'main-build' python-eks-e2e-test: - needs: [ java-metric-limiter-e2e-test ] + needs: [ CheckBuildTestArtifacts, java-metric-limiter-e2e-test ] uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-eks-e2e-test.yml@main secrets: inherit with: @@ -66,6 +79,7 @@ jobs: caller-workflow-name: 'main-build' python-ec2-default-e2e-test: + needs: [ CheckBuildTestArtifacts ] uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-ec2-default-e2e-test.yml@main secrets: inherit with: @@ -73,6 +87,7 @@ jobs: caller-workflow-name: 'main-build' python-ec2-asg-e2e-test: + needs: [ CheckBuildTestArtifacts ] uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-ec2-asg-e2e-test.yml@main secrets: inherit with: @@ -80,7 +95,7 @@ jobs: caller-workflow-name: 'main-build' python-k8s-e2e-test: - needs: [ java-k8s-e2e-test ] + needs: [ CheckBuildTestArtifacts, java-k8s-e2e-test ] uses: aws-observability/aws-application-signals-test-framework/.github/workflows/python-k8s-e2e-test.yml@main secrets: inherit with: diff --git a/.github/workflows/build-test-artifacts.yml b/.github/workflows/build-test-artifacts.yml new file mode 100644 index 0000000000..5eacc04c8d --- /dev/null +++ b/.github/workflows/build-test-artifacts.yml @@ -0,0 +1,85 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: MIT + +name: Build Test Artifacts +on: + push: + branches: + - main* + paths-ignore: + - '**/*.md' + - 'NOTICE' + - 'RELEASE_NOTES' + - 'THIRD-PARTY' + - 'LICENSE' + - '.github/**' + - '!.github/workflows/build-test-artifacts.yml' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + BuildAndUpload: + uses: ./.github/workflows/test-build.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + BucketKey: "integration-test/binary/${{ github.sha }}" + PackageBucketKey: "integration-test/packaging/${{ github.sha }}" + TerraformAWSAssumeRole: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + Bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + + BuildAndUploadPackages: + uses: ./.github/workflows/test-build-packages.yml + needs: [BuildAndUpload] + secrets: inherit + permissions: + id-token: write + contents: read + with: + BucketKey: "integration-test/binary/${{ github.sha }}" + PackageBucketKey: "integration-test/packaging/${{ github.sha }}" + TerraformAWSAssumeRole: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + Bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + + BuildDocker: + needs: [BuildAndUpload] + uses: ./.github/workflows/test-build-docker.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + ContainerRepositoryNameAndTag: "cwagent-integration-test:${{ github.sha }}" + BucketKey: "integration-test/binary/${{ github.sha }}" + PackageBucketKey: "integration-test/packaging/${{ github.sha }}" + + BuildAndUploadITAR: + uses: ./.github/workflows/test-build.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + BucketKey: "integration-test/binary/${{ github.sha }}" + PackageBucketKey: "integration-test/packaging/${{ github.sha }}" + Region: "us-gov-east-1" + TerraformAWSAssumeRole: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + Bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + + BuildAndUploadCN: + uses: ./.github/workflows/test-build.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + BucketKey: "integration-test/binary/${{ github.sha }}" + PackageBucketKey: "integration-test/packaging/${{ github.sha }}" + Region: "cn-north-1" + TerraformAWSAssumeRole: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + Bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 42b26db3a9..482c45a7e4 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -20,94 +20,24 @@ env: S3_INTEGRATION_BUCKET_CN: ${{ vars.S3_INTEGRATION_BUCKET_CN }} on: - push: - branches: - - main* - paths-ignore: - - '**/*.md' - - 'NOTICE' - - 'RELEASE_NOTES' - - 'THIRD-PARTY' - - 'LICENSE' - - '.github/**' - - '!.github/workflows/integration-test.yml' - workflow_dispatch: - inputs: - plugins: - description: 'Comma delimited list of plugins to test. Default is empty, and tests everything' - required: false - default: '' - type: string + workflow_run: + workflows: [ Build Test Artifacts ] + types: + - completed concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} cancel-in-progress: true jobs: - BuildAndUpload: - uses: ./.github/workflows/test-build.yml - secrets: inherit - permissions: - id-token: write - contents: read - with: - BucketKey: "integration-test/binary/${{ github.sha }}" - PackageBucketKey: "integration-test/packaging/${{ github.sha }}" - TerraformAWSAssumeRole: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} - Bucket: ${{ vars.S3_INTEGRATION_BUCKET }} - - BuildAndUploadPackages: - uses: ./.github/workflows/test-build-packages.yml - needs: [BuildAndUpload] - secrets: inherit - permissions: - id-token: write - contents: read - with: - BucketKey: "integration-test/binary/${{ github.sha }}" - PackageBucketKey: "integration-test/packaging/${{ github.sha }}" - TerraformAWSAssumeRole: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} - Bucket: ${{ vars.S3_INTEGRATION_BUCKET }} - - BuildDocker: - needs: [BuildAndUpload] - uses: ./.github/workflows/test-build-docker.yml - secrets: inherit - permissions: - id-token: write - contents: read - with: - ContainerRepositoryNameAndTag: "cwagent-integration-test:${{ github.sha }}" - BucketKey: "integration-test/binary/${{ github.sha }}" - PackageBucketKey: "integration-test/packaging/${{ github.sha }}" - - BuildAndUploadITAR: - uses: ./.github/workflows/test-build.yml - secrets: inherit - permissions: - id-token: write - contents: read - with: - BucketKey: "integration-test/binary/${{ github.sha }}" - PackageBucketKey: "integration-test/packaging/${{ github.sha }}" - Region: "us-gov-east-1" - TerraformAWSAssumeRole: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} - Bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} - - BuildAndUploadCN: - uses: ./.github/workflows/test-build.yml - secrets: inherit - permissions: - id-token: write - contents: read - with: - BucketKey: "integration-test/binary/${{ github.sha }}" - PackageBucketKey: "integration-test/packaging/${{ github.sha }}" - Region: "cn-north-1" - TerraformAWSAssumeRole: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} - Bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + CheckBuildTestArtifacts: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - run: echo 'The triggering build workflow succeeded' GenerateTestMatrix: + needs: [ CheckBuildTestArtifacts ] name: 'GenerateTestMatrix' runs-on: ubuntu-latest outputs: @@ -126,8 +56,6 @@ jobs: ec2_linux_itar_matrix: ${{ steps.set-matrix.outputs.ec2_linux_itar_matrix }} ec2_linux_china_matrix: ${{ steps.set-matrix.outputs.ec2_linux_china_matrix }} eks_addon_matrix: ${{ steps.set-matrix.outputs.eks_addon_matrix }} - - steps: - uses: actions/checkout@v3 with: @@ -178,7 +106,7 @@ jobs: echo "ec2_linux_china_matrix: ${{ steps.set-matrix.outputs.ec2_linux_china_matrix }}" CloudformationTest: - needs: [BuildAndUpload, GenerateTestMatrix] + needs: [GenerateTestMatrix] name: 'CFTest' runs-on: ubuntu-latest strategy: @@ -272,7 +200,7 @@ jobs: EC2NvidiaGPUIntegrationTest: - needs: [ BuildAndUpload, StartLocalStack, GenerateTestMatrix ] + needs: [ StartLocalStack, GenerateTestMatrix ] name: 'EC2NVIDIAGPUIntegrationTest' runs-on: ubuntu-latest strategy: @@ -387,6 +315,7 @@ jobs: terraform destroy --auto-approve OutputEnvVariables: + needs: [CheckBuildTestArtifacts] name: 'OutputEnvVariables' runs-on: ubuntu-latest outputs: @@ -418,7 +347,7 @@ jobs: echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" EC2LinuxIntegrationTest: - needs: [ BuildAndUpload, StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] name: 'EC2Linux' uses: ./.github/workflows/ec2-integration-test.yml with: @@ -436,7 +365,7 @@ jobs: secrets: inherit EC2LinuxIntegrationTestITAR: - needs: [ BuildAndUpload, BuildAndUploadITAR, StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] + needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] name: 'EC2LinuxITAR' uses: ./.github/workflows/ec2-integration-test.yml with: @@ -454,7 +383,7 @@ jobs: secrets: inherit EC2LinuxIntegrationTestCN: - needs: [ BuildAndUpload, BuildAndUploadCN, StartLocalStackCN, GenerateTestMatrix, OutputEnvVariables ] + needs: [ StartLocalStackCN, GenerateTestMatrix, OutputEnvVariables ] name: 'EC2LinuxCN' uses: ./.github/workflows/ec2-integration-test.yml with: @@ -473,7 +402,7 @@ jobs: LinuxOnPremIntegrationTest: - needs: [BuildAndUpload, StartLocalStack, GenerateTestMatrix, OutputEnvVariables] + needs: [StartLocalStack, GenerateTestMatrix, OutputEnvVariables] name: 'OnpremLinux' uses: ./.github/workflows/ec2-integration-test.yml with: @@ -489,7 +418,7 @@ jobs: secrets: inherit EC2WinIntegrationTest: - needs: [BuildAndUpload, BuildAndUploadPackages, GenerateTestMatrix] + needs: [GenerateTestMatrix] name: 'EC2WinIntegrationTest' runs-on: ubuntu-latest strategy: @@ -571,7 +500,7 @@ jobs: terraform destroy --auto-approve EC2DarwinIntegrationTest: - needs: [BuildAndUpload, BuildAndUploadPackages, GenerateTestMatrix] + needs: [GenerateTestMatrix] name: 'EC2DarwinIntegrationTest' runs-on: ubuntu-latest strategy: @@ -705,7 +634,7 @@ jobs: ECSEC2IntegrationTest: name: 'ECSEC2IntegrationTest' runs-on: ubuntu-latest - needs: [ BuildAndUpload, BuildDocker, GenerateTestMatrix ] + needs: [ GenerateTestMatrix ] strategy: fail-fast: false matrix: @@ -788,7 +717,7 @@ jobs: ECSFargateIntegrationTest: name: 'ECSFargateIntegrationTest' runs-on: ubuntu-latest - needs: [BuildAndUpload, BuildDocker, GenerateTestMatrix] + needs: [GenerateTestMatrix] strategy: fail-fast: false matrix: @@ -866,7 +795,7 @@ jobs: EKSIntegrationTest: name: 'EKSIntegrationTest' runs-on: ubuntu-latest - needs: [ BuildAndUpload, BuildDocker, GenerateTestMatrix ] + needs: [ GenerateTestMatrix ] strategy: fail-fast: false matrix: @@ -948,7 +877,7 @@ jobs: EKSPrometheusIntegrationTest: name: 'EKSPrometheusIntegrationTest' runs-on: ubuntu-latest - needs: [ BuildAndUpload, BuildDocker, GenerateTestMatrix ] + needs: [ GenerateTestMatrix ] strategy: fail-fast: false matrix: @@ -1027,7 +956,7 @@ jobs: PerformanceTrackingTest: name: "PerformanceTrackingTest" - needs: [BuildAndUpload, GenerateTestMatrix] + needs: [GenerateTestMatrix] runs-on: ubuntu-latest strategy: fail-fast: false @@ -1095,7 +1024,7 @@ jobs: EC2WinPerformanceTest: name: "EC2WinPerformanceTest" - needs: [ BuildAndUpload, BuildAndUploadPackages, GenerateTestMatrix ] + needs: [ GenerateTestMatrix ] runs-on: ubuntu-latest strategy: fail-fast: false @@ -1163,7 +1092,7 @@ jobs: StressTrackingTest: name: "StressTrackingTest" - needs: [BuildAndUpload, GenerateTestMatrix] + needs: [GenerateTestMatrix] runs-on: ubuntu-latest strategy: fail-fast: false @@ -1233,7 +1162,7 @@ jobs: EC2WinStressTrackingTest: name: "EC2WinStressTrackingTest" - needs: [BuildAndUpload, BuildAndUploadPackages, GenerateTestMatrix] + needs: [GenerateTestMatrix] runs-on: ubuntu-latest strategy: fail-fast: false @@ -1302,18 +1231,9 @@ jobs: retry_wait_seconds: 5 command: cd terraform/stress && terraform destroy --auto-approve - ApplicationSignalsEndToEndTest: - name: "Application Signals E2E Test" - needs: [ BuildAndUpload, BuildDocker ] - uses: ./.github/workflows/application-signals-e2e-test.yml - secrets: inherit - permissions: - id-token: write - contents: read - GPUEndToEndTest: name: "GPU E2E Test" - needs: [ BuildAndUpload, StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] runs-on: ubuntu-latest strategy: fail-fast: false From a854c7504b1fb57d84242788c2dbbdbe6af32696 Mon Sep 17 00:00:00 2001 From: Jeffrey Chien Date: Fri, 2 Aug 2024 18:43:38 -0400 Subject: [PATCH 2/3] Add pull request trigger for testing. --- .github/workflows/build-test-artifacts.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/build-test-artifacts.yml b/.github/workflows/build-test-artifacts.yml index 5eacc04c8d..0a39d0ba9a 100644 --- a/.github/workflows/build-test-artifacts.yml +++ b/.github/workflows/build-test-artifacts.yml @@ -3,6 +3,15 @@ name: Build Test Artifacts on: + pull_request: + branches: + - main* + - feature* + types: + - opened + - synchronize + - reopened + - ready_for_review push: branches: - main* From a2ab225e88ef5fe0a7b7cf52832868373bd46a27 Mon Sep 17 00:00:00 2001 From: Jeffrey Chien Date: Mon, 5 Aug 2024 10:06:36 -0400 Subject: [PATCH 3/3] Remove pull request trigger. --- .github/workflows/build-test-artifacts.yml | 9 --------- .github/workflows/integration-test.yml | 10 +++++----- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-test-artifacts.yml b/.github/workflows/build-test-artifacts.yml index 0a39d0ba9a..5eacc04c8d 100644 --- a/.github/workflows/build-test-artifacts.yml +++ b/.github/workflows/build-test-artifacts.yml @@ -3,15 +3,6 @@ name: Build Test Artifacts on: - pull_request: - branches: - - main* - - feature* - types: - - opened - - synchronize - - reopened - - ready_for_review push: branches: - main* diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 482c45a7e4..5afd0863f4 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -582,7 +582,7 @@ jobs: StopLocalStack: name: 'StopLocalStack' - if: ${{ always() }} + if: ${{ always() && needs.StartLocalStack.result == 'success' }} needs: [ StartLocalStack, EC2LinuxIntegrationTest, LinuxOnPremIntegrationTest, OutputEnvVariables ] uses: ./.github/workflows/stop-localstack.yml secrets: inherit @@ -599,8 +599,8 @@ jobs: StopLocalStackITAR: name: 'StopLocalStackITAR' - if: ${{ always() }} - needs: [ EC2LinuxIntegrationTestITAR, OutputEnvVariables ] + if: ${{ always() && needs.StartLocalStackITAR.result == 'success' }} + needs: [ StartLocalStackITAR, EC2LinuxIntegrationTestITAR, OutputEnvVariables ] uses: ./.github/workflows/stop-localstack.yml secrets: inherit permissions: @@ -616,8 +616,8 @@ jobs: StopLocalStackCN: name: 'StopLocalStackCN' - if: ${{ always() }} - needs: [ EC2LinuxIntegrationTestCN ] + if: ${{ always() && needs.StartLocalStackCN.result == 'success' }} + needs: [ StartLocalStackCN, EC2LinuxIntegrationTestCN ] uses: ./.github/workflows/stop-localstack.yml secrets: inherit permissions: