From f0ae89ecc515106aa520e3da49397c36cb1f958e Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Wed, 5 Feb 2025 10:09:03 -0500 Subject: [PATCH 01/39] new workflow that accepts agent s3 path --- .github/workflows/integration-test-s3.yml | 1259 +++++++++++++++++++++ 1 file changed, 1259 insertions(+) create mode 100644 .github/workflows/integration-test-s3.yml diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/integration-test-s3.yml new file mode 100644 index 0000000000..8e5af9dc02 --- /dev/null +++ b/.github/workflows/integration-test-s3.yml @@ -0,0 +1,1259 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: MIT + +name: Run Integration Tests on S3 +env: + PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY }} + TERRAFORM_AWS_ASSUME_ROLE: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + TERRAFORM_AWS_ASSUME_ROLE_DURATION: 14400 # 4 hours + KEY_NAME: ${{ secrets.KEY_NAME }} + CF_IAM_ROLE: ${{ secrets.CF_IAM_ROLE }} + CF_KEY_NAME: ${{ secrets.CF_KEY_NAME }} + ECR_INTEGRATION_TEST_REPO: "cwagent-integration-test" + CWA_GITHUB_TEST_REPO_NAME: "aws/amazon-cloudwatch-agent-test" + CWA_GITHUB_TEST_REPO_URL: "https://github.com/aws/amazon-cloudwatch-agent-test.git" + CWA_GITHUB_TEST_REPO_BRANCH: "main" + TERRAFORM_AWS_ASSUME_ROLE_ITAR: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + S3_INTEGRATION_BUCKET_ITAR: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + TERRAFORM_AWS_ASSUME_ROLE_CN: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + S3_INTEGRATION_BUCKET_CN: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + +on: + workflow_dispatch: + inputs: + agent_s3_path: + description: 'The base s3 path for the RPM to run the integration tests for' + type: string + required: true + test_repo_branch_override: + description: 'Override for the test repo branch' + type: string + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + OutputEnvVariables: + name: 'OutputEnvVariables' + runs-on: ubuntu-latest + outputs: + CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }} + CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }} + CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + steps: + - uses: actions/checkout@v3 + with: + repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + - name: Set up Go 1.x + uses: actions/setup-go@v4 + with: + go-version: ~1.22.2 + + - name: SetOutputs + id: set-outputs + run: | + CWA_GITHUB_TEST_REPO_BRANCH=${{ env.CWA_GITHUB_TEST_REPO_BRANCH }} + if [ "${{ inputs.test_repo_branch_override }}" != "" ]; then + CWA_GITHUB_TEST_REPO_BRANCH=${{ inputs.test_repo_branch_override }} + fi + + echo "AGENT_S3_PATH=${{ inputs.agent_s3_path }}" >> "$GITHUB_OUTPUT" + echo "CWA_GITHUB_TEST_REPO_NAME=${{ env.CWA_GITHUB_TEST_REPO_NAME }}" >> "$GITHUB_OUTPUT" + echo "CWA_GITHUB_TEST_REPO_URL=${{ env.CWA_GITHUB_TEST_REPO_URL }}" >> "$GITHUB_OUTPUT" + echo "CWA_GITHUB_TEST_REPO_BRANCH=$CWA_GITHUB_TEST_REPO_BRANCH" >> "$GITHUB_OUTPUT" + + - name: Echo test variables + run: | + echo "AGENT_S3_PATH: ${{ inputs.agent_s3_path }}" + echo "CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}" + echo "CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}" + echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" + + GenerateTestMatrix: + name: 'GenerateTestMatrix' + runs-on: ubuntu-latest + outputs: + ec2_gpu_matrix: ${{ steps.set-matrix.outputs.ec2_gpu_matrix }} + ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_matrix }} + ec2_windows_matrix: ${{ steps.set-matrix.outputs.ec2_windows_matrix }} + ec2_mac_matrix: ${{ steps.set-matrix.outputs.ec2_mac_matrix }} + ec2_performance_matrix: ${{steps.set-matrix.outputs.ec2_performance_matrix}} + ec2_windows_performance_matrix: ${{steps.set-matrix.outputs.ec2_windows_performance_matrix}} + ec2_stress_matrix: ${{steps.set-matrix.outputs.ec2_stress_matrix}} + ec2_windows_stress_matrix: ${{steps.set-matrix.outputs.ec2_windows_stress_matrix}} + ecs_ec2_launch_daemon_matrix: ${{ steps.set-matrix.outputs.ecs_ec2_launch_daemon_matrix }} + ecs_fargate_matrix: ${{ steps.set-matrix.outputs.ecs_fargate_matrix }} + eks_daemon_matrix: ${{ steps.set-matrix.outputs.eks_daemon_matrix }} + eks_deployment_matrix: ${{ steps.set-matrix.outputs.eks_deployment_matrix }} + 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: + repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + - name: Set up Go 1.x + uses: actions/setup-go@v4 + with: + go-version: ~1.22.2 + + - name: Generate matrix + id: set-matrix + run: | + go run --tags=generator generator/test_case_generator.go + echo "ec2_gpu_matrix=$(echo $(cat generator/resources/ec2_gpu_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "eks_addon_matrix=$(echo $(cat generator/resources/eks_addon_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_linux_matrix=$(echo $(cat generator/resources/ec2_linux_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_windows_matrix=$(echo $(cat generator/resources/ec2_windows_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_mac_matrix=$(echo $(cat generator/resources/ec2_mac_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_performance_matrix=$(echo $(cat generator/resources/ec2_performance_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_windows_performance_matrix=$(echo $(cat generator/resources/ec2_windows_performance_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_stress_matrix=$(echo $(cat generator/resources/ec2_stress_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_windows_stress_matrix=$(echo $(cat generator/resources/ec2_windows_stress_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ecs_ec2_launch_daemon_matrix=$(echo $(cat generator/resources/ecs_ec2_daemon_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ecs_fargate_matrix=$(echo $(cat generator/resources/ecs_fargate_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "eks_daemon_matrix=$(echo $(cat generator/resources/eks_daemon_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "eks_deployment_matrix=$(echo $(cat generator/resources/eks_deployment_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_linux_itar_matrix=$(echo $(cat generator/resources/ec2_linux_itar_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_linux_china_matrix=$(echo $(cat generator/resources/ec2_linux_china_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + + - name: Echo test plan matrix + run: | + echo "ec2_gpu_matrix: ${{ steps.set-matrix.outputs.ec2_gpu_matrix }}" + echo "eks_addon_matrix: ${{ steps.set-matrix.outputs.eks_addon_matrix }}" + echo "ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_matrix }}" + echo "ec2_windows_matrix: ${{ steps.set-matrix.outputs.ec2_windows_matrix }}" + echo "ec2_mac_matrix: ${{ steps.set-matrix.outputs.ec2_mac_matrix }}" + echo "ec2_performance_matrix: ${{ steps.set-matrix.outputs.ec2_performance_matrix}}" + echo "ec2_windows_performance_matrix: ${{ steps.set-matrix.outputs.ec2_windows_performance_matrix}}" + echo "ec2_stress_matrix: ${{ steps.set-matrix.outputs.ec2_stress_matrix}}" + echo "ec2_windows_stress_matrix: ${{ steps.set-matrix.outputs.ec2_windows_stress_matrix}}" + echo "ecs_ec2_launch_daemon_matrix: ${{ steps.set-matrix.outputs.ecs_ec2_launch_daemon_matrix }}" + echo "ecs_fargate_matrix: ${{ steps.set-matrix.outputs.ecs_fargate_matrix }}" + echo "eks_daemon_matrix: ${{ steps.set-matrix.outputs.eks_daemon_matrix }}" + echo "eks_deployment_matrix: ${{ steps.set-matrix.outputs.eks_deployment_matrix }}" + echo "ec2_linux_itar_matrix: ${{ steps.set-matrix.outputs.ec2_linux_itar_matrix }}" + echo "ec2_linux_china_matrix: ${{ steps.set-matrix.outputs.ec2_linux_china_matrix }}" + + CloudformationTest: + needs: [OutputEnvVariables, GenerateTestMatrix] + name: 'CFTest' + runs-on: ubuntu-latest + strategy: + fail-fast: false + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + with: + repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + path: test + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ~1.22.2 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + - name: Test cf + run: | + cd test/test/cloudformation + echo s3://${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH }} + # go test -timeout 1h -package_path=s3://${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent + + # StartLocalStack: + # name: 'StartLocalStack' + # needs: [OutputEnvVariables] + # uses: ./.github/workflows/start-localstack.yml + # secrets: inherit + # permissions: + # id-token: write + # contents: read + # with: + # region: us-west-2 + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # github_sha: ${{github.sha}} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + + # StartLocalStackITAR: + # name: 'StartLocalStackITAR' + # needs: [OutputEnvVariables] + # uses: ./.github/workflows/start-localstack.yml + # secrets: inherit + # permissions: + # id-token: write + # contents: read + # with: + # region: us-gov-east-1 + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # github_sha: ${{github.sha}} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + + # StartLocalStackCN: + # name: 'StartLocalStackCN' + # needs: [ OutputEnvVariables ] + # uses: ./.github/workflows/start-localstack.yml + # secrets: inherit + # permissions: + # id-token: write + # contents: read + # with: + # region: cn-north-1 + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # github_sha: ${{github.sha}} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + + + + # EC2NvidiaGPUIntegrationTest: + # needs: [ StartLocalStack, GenerateTestMatrix ] + # name: 'EC2NVIDIAGPUIntegrationTest' + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_gpu_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Echo Test Info + # run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # # nick-fields/retry@v2 starts at base dir + # - name: Terraform apply + # if: ${{ matrix.arrays.family == 'linux' }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 30 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/linux + # fi + + # terraform init + # if terraform apply --auto-approve \ + # -var="ssh_key_value=${PRIVATE_KEY}" -var="github_test_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ + # -var="test_name=${{ matrix.arrays.os }}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ + # -var="github_test_repo_branch=${{env.CWA_GITHUB_TEST_REPO_BRANCH}}" \ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="user=${{ matrix.arrays.username }}" \ + # -var="ami=${{ matrix.arrays.ami }}" \ + # -var="ca_cert_path=${{ matrix.arrays.caCertPath }}" \ + # -var="arc=${{ matrix.arrays.arc }}" \ + # -var="binary_name=${{ matrix.arrays.binaryName }}" \ + # -var="local_stack_host_name=${{ needs.StartLocalStack.outputs.local_stack_host_name }}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + # -var="ssh_key_name=${KEY_NAME}" \ + # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + # - name: Terraform apply + # if: ${{ matrix.arrays.family == 'window' }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 30 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/win + # fi + # terraform init + # if terraform apply --auto-approve \ + # -var="ssh_key_value=${PRIVATE_KEY}" -var="ssh_key_name=${KEY_NAME}" \ + # -var="github_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" -var="ami=${{ matrix.arrays.ami }}" \ + # -var="test_dir=${{ matrix.arrays.test_dir }}" \ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="github_test_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ + # -var="github_test_repo_branch=${{env.CWA_GITHUB_TEST_REPO_BRANCH}}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" ; then terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + # #This is here just in case workflow cancel + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # elif if "${{ matrix.arrays.os }}" == window; then + # cd terraform/ec2/win + # else + # cd terraform/ec2/linux + # fi + # terraform destroy --auto-approve + + # EC2LinuxIntegrationTest: + # needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + # name: 'EC2Linux' + # uses: ./.github/workflows/ec2-integration-test.yml + # with: + # github_sha: ${{github.sha}} + # test_dir: terraform/ec2/linux + # job_id: ec2-linux-integration-test + # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_matrix}} + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} + # region: us-west-2 + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + # secrets: inherit + + # EC2LinuxIntegrationTestITAR: + # needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] + # name: 'EC2LinuxITAR' + # uses: ./.github/workflows/ec2-integration-test.yml + # with: + # github_sha: ${{github.sha}} + # test_dir: terraform/ec2/linux + # job_id: ec2-linux-integration-test + # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_itar_matrix}} + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # localstack_host: ${{needs.StartLocalStackITAR.outputs.local_stack_host_name}} + # region: us-gov-east-1 + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + # secrets: inherit + + # EC2LinuxIntegrationTestCN: + # needs: [ StartLocalStackCN, GenerateTestMatrix, OutputEnvVariables ] + # name: 'EC2LinuxCN' + # uses: ./.github/workflows/ec2-integration-test.yml + # with: + # github_sha: ${{github.sha}} + # test_dir: terraform/ec2/linux + # job_id: ec2-linux-integration-test + # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_china_matrix}} + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # localstack_host: ${{needs.StartLocalStackCN.outputs.local_stack_host_name}} + # region: cn-north-1 + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + # secrets: inherit + + + # LinuxOnPremIntegrationTest: + # needs: [StartLocalStack, GenerateTestMatrix, OutputEnvVariables] + # name: 'OnpremLinux' + # uses: ./.github/workflows/ec2-integration-test.yml + # with: + # github_sha: ${{github.sha}} + # test_dir: terraform/ec2/linux_onprem + # job_id: linux-onprem-integration-test + # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_onprem_matrix}} + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} + # region: us-west-2 + # secrets: inherit + + # EC2WinIntegrationTest: + # needs: [GenerateTestMatrix] + # name: 'EC2WinIntegrationTest' + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Echo Test Info + # run: echo run on ec2 instance os ${{ matrix.arrays.os }} use ssm ${{ matrix.arrays.useSSM }} test ${{ matrix.arrays.test_dir }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # # nick-fields/retry@v2 starts at base dir + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 30 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/win + # fi + # terraform init + # if terraform apply --auto-approve \ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="ssh_key_value=${PRIVATE_KEY}" -var="ssh_key_name=${KEY_NAME}" \ + # -var="test_name=${{ matrix.arrays.os }}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" \ + # -var="test_dir=${{ matrix.arrays.test_dir }}" \ + # -var="ami=${{ matrix.arrays.ami }}" \ + # -var="use_ssm=${{ matrix.arrays.useSSM }}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" ; then + # terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # #This is here just in case workflow cancel + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/win + # fi + # terraform destroy --auto-approve + + # EC2DarwinIntegrationTest: + # needs: [GenerateTestMatrix] + # name: 'EC2DarwinIntegrationTest' + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_mac_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Echo OS + # run: echo run on ec2 instance os ${{ matrix.arrays.os }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # # nick-fields/retry@v2 starts at base dir + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 60 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/mac + # fi + # terraform init + # if terraform apply --auto-approve \ + # -var="ssh_key_value=${PRIVATE_KEY}" -var="ssh_key_name=${KEY_NAME}" \ + # -var="arc=${{ matrix.arrays.arc }}" \ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" -var="ami=${{ matrix.arrays.ami }}" \ + # -var="test_dir=${{ matrix.arrays.test_dir }}" \ + # -var="license_manager_arn=${{ env.LICENSE_MANAGER_ARN }}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" ; then + # terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # #This is here just in case workflow cancel + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/mac + # fi + # terraform destroy --auto-approve + + # StopLocalStack: + # name: 'StopLocalStack' + # if: ${{ always() && needs.StartLocalStack.result == 'success' }} + # needs: [ StartLocalStack, EC2LinuxIntegrationTest, LinuxOnPremIntegrationTest, OutputEnvVariables ] + # uses: ./.github/workflows/stop-localstack.yml + # secrets: inherit + # permissions: + # id-token: write + # contents: read + # with: + # region: us-west-2 + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + # github_sha: ${{github.sha}} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + + # StopLocalStackITAR: + # name: 'StopLocalStackITAR' + # if: ${{ always() && needs.StartLocalStackITAR.result == 'success' }} + # needs: [ StartLocalStackITAR, EC2LinuxIntegrationTestITAR, OutputEnvVariables ] + # uses: ./.github/workflows/stop-localstack.yml + # secrets: inherit + # permissions: + # id-token: write + # contents: read + # with: + # region: us-gov-east-1 + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + # github_sha: ${{github.sha}} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + + # StopLocalStackCN: + # name: 'StopLocalStackCN' + # if: ${{ always() && needs.StartLocalStackCN.result == 'success' }} + # needs: [ StartLocalStackCN, EC2LinuxIntegrationTestCN ] + # uses: ./.github/workflows/stop-localstack.yml + # secrets: inherit + # permissions: + # id-token: write + # contents: read + # with: + # region: cn-north-1 + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + # github_sha: ${{github.sha}} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + + # ECSEC2IntegrationTest: + # name: 'ECSEC2IntegrationTest' + # runs-on: ubuntu-latest + # needs: [ GenerateTestMatrix ] + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ecs_ec2_launch_daemon_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Login ECR + # id: login-ecr + # uses: aws-actions/amazon-ecr-login@v2 + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 15 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ecs_ec2/daemon + # fi + + # terraform init + # if terraform apply --auto-approve\ + # -var="test_dir=${{ matrix.arrays.test_dir }}"\ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ + # -var="cwagent_image_tag=${{ github.sha }}"\ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="metadataEnabled=${{ matrix.arrays.metadataEnabled }}" \ + # -var="ami=${{ matrix.arrays.ami }}" ; then + # terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ecs_ec2/daemon + # fi + # terraform destroy --auto-approve + + # ECSFargateIntegrationTest: + # name: 'ECSFargateIntegrationTest' + # runs-on: ubuntu-latest + # needs: [GenerateTestMatrix] + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ecs_fargate_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Login ECR + # id: login-ecr + # uses: aws-actions/amazon-ecr-login@v2 + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 15 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ecs_fargate/linux + # fi + + # terraform init + # if terraform apply --auto-approve\ + # -var="test_dir=${{ matrix.arrays.test_dir }}"\ + # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ + # -var="cwagent_image_tag=${{ github.sha }}"; then + # terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ecs_fargate/linux + # fi + # terraform destroy --auto-approve + + # EKSIntegrationTest: + # name: 'EKSIntegrationTest' + # runs-on: ubuntu-latest + # needs: [ GenerateTestMatrix ] + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.eks_daemon_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Login ECR + # id: login-ecr + # uses: aws-actions/amazon-ecr-login@v2 + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 2 + # timeout_minutes: 90 # EKS takes about 20 minutes to spin up a cluster and service on the cluster + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/daemon + # fi + + # terraform init + # if terraform apply --auto-approve \ + # -var="test_dir=${{ matrix.arrays.test_dir }}"\ + # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \ + # -var="cwagent_image_tag=${{ github.sha }}" \ + # -var="ami_type=${{ matrix.arrays.ami }}" \ + # -var="instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="k8s_version=${{ matrix.arrays.k8sVersion }}"; then + # terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/daemon + # fi + # terraform destroy --auto-approve + + # EKSPrometheusIntegrationTest: + # name: 'EKSPrometheusIntegrationTest' + # runs-on: ubuntu-latest + # needs: [ GenerateTestMatrix ] + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.eks_deployment_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Login ECR + # id: login-ecr + # uses: aws-actions/amazon-ecr-login@v2 + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 60 # EKS takes about 20 minutes to spin up a cluster and service on the cluster + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/deployment + # fi + + # terraform init + # if terraform apply --auto-approve \ + # -var="test_dir=${{ matrix.arrays.test_dir }}"\ + # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \ + # -var="cwagent_image_tag=${{ github.sha }}" \ + # -var="k8s_version=${{ matrix.arrays.k8s_version }}"; then + # terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/deployment + # fi + # terraform destroy --auto-approve + + # PerformanceTrackingTest: + # name: "PerformanceTrackingTest" + # needs: [GenerateTestMatrix] + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_performance_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 1 + # timeout_minutes: 60 + # retry_wait_seconds: 5 + # command: | + # cd terraform/performance + # terraform init + # if terraform apply --auto-approve \ + # -var="ssh_key_value=${PRIVATE_KEY}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" \ + # -var="ami=${{ matrix.arrays.ami }}" \ + # -var="arc=${{ matrix.arrays.arc }}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + # -var="ssh_key_name=${KEY_NAME}" \ + # -var="values_per_minute=${{ matrix.arrays.values_per_minute}}"\ + # -var="family=${{ matrix.arrays.family}}"\ + # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: cd terraform/performance && terraform destroy --auto-approve + + # EC2WinPerformanceTest: + # name: "EC2WinPerformanceTest" + # needs: [ GenerateTestMatrix ] + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_performance_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 1 + # timeout_minutes: 60 + # retry_wait_seconds: 5 + # command: | + # cd terraform/performance + # terraform init + # if terraform apply --auto-approve \ + # -var="ssh_key_value=${PRIVATE_KEY}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" \ + # -var="ami=${{ matrix.arrays.ami }}" \ + # -var="arc=${{ matrix.arrays.arc }}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + # -var="ssh_key_name=${KEY_NAME}" \ + # -var="values_per_minute=${{ matrix.arrays.values_per_minute}}"\ + # -var="family=${{ matrix.arrays.family}}"\ + # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: cd terraform/performance && terraform destroy --auto-approve + + # StressTrackingTest: + # name: "StressTrackingTest" + # needs: [GenerateTestMatrix] + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_stress_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Echo Test Info + # run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }} values per minute ${{ matrix.arrays.values_per_minute }} + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 1 + # timeout_minutes: 60 + # retry_wait_seconds: 5 + # command: | + # cd terraform/stress + # terraform init + # if terraform apply --auto-approve \ + # -var="ssh_key_value=${PRIVATE_KEY}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" \ + # -var="ami=${{ matrix.arrays.ami }}" \ + # -var="arc=${{ matrix.arrays.arc }}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + # -var="ssh_key_name=${KEY_NAME}" \ + # -var="values_per_minute=${{ matrix.arrays.values_per_minute}}"\ + # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: cd terraform/stress && terraform destroy --auto-approve + + # EC2WinStressTrackingTest: + # name: "EC2WinStressTrackingTest" + # needs: [GenerateTestMatrix] + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_stress_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Echo Test Info + # run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }} values per minute ${{ matrix.arrays.values_per_minute }} + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 1 + # timeout_minutes: 60 + # retry_wait_seconds: 5 + # command: | + # cd terraform/stress + # terraform init + # if terraform apply --auto-approve \ + # -var="ssh_key_value=${PRIVATE_KEY}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" \ + # -var="ami=${{ matrix.arrays.ami }}" \ + # -var="arc=${{ matrix.arrays.arc }}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + # -var="ssh_key_name=${KEY_NAME}" \ + # -var="values_per_minute=${{ matrix.arrays.values_per_minute}}"\ + # -var="family=${{ matrix.arrays.family}}"\ + # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: cd terraform/stress && terraform destroy --auto-approve + + # GPUEndToEndTest: + # name: "GPU E2E Test" + # needs: [ GenerateTestMatrix, OutputEnvVariables ] + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.eks_addon_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Terraform apply and setup + # run: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/addon/gpu + # fi + + # terraform init + # if terraform apply --auto-approve \ + # -var="beta=true" \ + # -var="ami_type=${{ matrix.arrays.ami }}" \ + # -var="instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="k8s_version=${{ matrix.arrays.k8sVersion }}"; then + # echo "Terraform apply successful." + + # # Capture the output + # echo "Getting EKS cluster name" + # EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) + # echo "Cluster name is ${EKS_CLUSTER_NAME}" + # kubectl create -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.17.0/deployments/static/nvidia-device-plugin.yml + # kubectl patch amazoncloudwatchagents -n amazon-cloudwatch cloudwatch-agent --type='json' -p='[{"op": "replace", "path": "/spec/image", "value": ${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/${{ env.ECR_INTEGRATION_TEST_REPO }}:${{ github.sha }}}]' + # # wait nvidia device plugin to be ready + # sleep 10 + # kubectl apply -f ./gpuBurner.yaml + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Run Go tests with retry + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 5 + # timeout_minutes: 60 + # retry_wait_seconds: 30 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/addon/gpu + # fi + # echo "Getting EKS cluster name" + # EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) + # echo "Cluster name is ${EKS_CLUSTER_NAME}" + + # if go test ${{ matrix.arrays.test_dir }} -eksClusterName ${EKS_CLUSTER_NAME} -computeType=EKS -v -eksDeploymentStrategy=DAEMON -eksGpuType=nvidia -useE2EMetrics; then + # echo "Tests passed" + # else + # echo "Tests failed" + # exit 1 + # fi + + # - name: Terraform destroy + # if: always() + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/addon/gpu + # fi + # terraform destroy -auto-approve From 64287df61bbc3ba067393f723d567a17a03430fb Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Wed, 5 Feb 2025 10:19:45 -0500 Subject: [PATCH 02/39] Add on: pull_request to trigger the workflow once --- .github/workflows/integration-test-s3.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/integration-test-s3.yml index 8e5af9dc02..b4aafb29fb 100644 --- a/.github/workflows/integration-test-s3.yml +++ b/.github/workflows/integration-test-s3.yml @@ -28,6 +28,7 @@ on: test_repo_branch_override: description: 'Override for the test repo branch' type: string + pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} From bb0802667f67bcd804d2ab87ccf4c0a7453794d7 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Wed, 5 Feb 2025 12:09:41 -0500 Subject: [PATCH 03/39] Fix output variable --- .github/workflows/integration-test-s3.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/integration-test-s3.yml index b4aafb29fb..207fd181e0 100644 --- a/.github/workflows/integration-test-s3.yml +++ b/.github/workflows/integration-test-s3.yml @@ -39,6 +39,7 @@ jobs: name: 'OutputEnvVariables' runs-on: ubuntu-latest outputs: + AGENT_S3_PATH : ${{ steps.set-outputs.outputs.AGENT_S3_PATH }} CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }} CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }} CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} @@ -173,9 +174,9 @@ jobs: run: | cd test/test/cloudformation echo s3://${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH }} - # go test -timeout 1h -package_path=s3://${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent + go test -timeout 1h -package_path=s3://${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent - # StartLocalStack: + # StartLocalStack: # name: 'StartLocalStack' # needs: [OutputEnvVariables] # uses: ./.github/workflows/start-localstack.yml From bc3132c51f1028e662eb4d78422eade82c2d354e Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Wed, 5 Feb 2025 13:49:35 -0500 Subject: [PATCH 04/39] Create vars for windows and mac --- .github/workflows/ec2-integration-test.yml | 16 +- .github/workflows/integration-test-s3.yml | 181 ++++++++++----------- 2 files changed, 99 insertions(+), 98 deletions(-) diff --git a/.github/workflows/ec2-integration-test.yml b/.github/workflows/ec2-integration-test.yml index 5d1eb6245c..ed7413517a 100644 --- a/.github/workflows/ec2-integration-test.yml +++ b/.github/workflows/ec2-integration-test.yml @@ -40,6 +40,12 @@ on: type: string s3_integration_bucket: type: string + agent_s3_path_linux: + type: string + agent_s3_path_windows: + type: string + agent_s3_path_mac: + type: string jobs: EC2IntegrationTest: @@ -111,7 +117,12 @@ jobs: -var="excluded_tests='${{ matrix.arrays.excludedTests }}'" \ -var="ssh_key_name=${{env.KEY_NAME}}" \ -var="test_dir=${{ matrix.arrays.test_dir }}" \ - -var="agent_start=${{ matrix.arrays.agentStartCommand }}"; then terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" -auto-approve + -var="agent_start=${{ matrix.arrays.agentStartCommand }}" \ + -var="agent_s3_path_linux=${{ inputs.agent_s3_path_linux }} \ + -var="agent_s3_path_windows=${{ inputs.agent_s3_path_windows }} \ + -var="agent_s3_path_mac=${{ inputs.agent_s3_path_mac }}"; then + + terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" -auto-approve else terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" -auto-approve && exit 1 fi @@ -123,4 +134,5 @@ jobs: max_attempts: 2 timeout_minutes: 8 retry_wait_seconds: 5 - command: cd ${{ inputs.test_dir }} && terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" --auto-approve \ No newline at end of file + command: | + command: cd ${{ inputs.test_dir }} && terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" --auto-approve diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/integration-test-s3.yml index 207fd181e0..423f29ca2c 100644 --- a/.github/workflows/integration-test-s3.yml +++ b/.github/workflows/integration-test-s3.yml @@ -6,6 +6,7 @@ env: PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY }} TERRAFORM_AWS_ASSUME_ROLE: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} TERRAFORM_AWS_ASSUME_ROLE_DURATION: 14400 # 4 hours + S3_INTEGRATION_BUCKET: ${{ vars.S3_INTEGRATION_BUCKET }} KEY_NAME: ${{ secrets.KEY_NAME }} CF_IAM_ROLE: ${{ secrets.CF_IAM_ROLE }} CF_KEY_NAME: ${{ secrets.CF_KEY_NAME }} @@ -26,9 +27,8 @@ on: type: string required: true test_repo_branch_override: - description: 'Override for the test repo branch' + description: 'Override for the test repo branch (default is main)' type: string - pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} @@ -39,7 +39,9 @@ jobs: name: 'OutputEnvVariables' runs-on: ubuntu-latest outputs: - AGENT_S3_PATH : ${{ steps.set-outputs.outputs.AGENT_S3_PATH }} + AGENT_S3_PATH_LINUX: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_LINUX }} + AGENT_S3_PATH_WINDOWS: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_WINDOWS }} + AGENT_S3_PATH_MAC: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_MAC }} CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }} CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }} CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} @@ -62,14 +64,22 @@ jobs: CWA_GITHUB_TEST_REPO_BRANCH=${{ inputs.test_repo_branch_override }} fi - echo "AGENT_S3_PATH=${{ inputs.agent_s3_path }}" >> "$GITHUB_OUTPUT" + AGENT_S3_PATH_LINUX=${{ inputs.agent_s3_path }} + AGENT_S3_PATH_WINDOWS=${AGENT_S3_PATH_LINUX/binary/packaging} + AGENT_S3_PATH_MAC=${AGENT_S3_PATH_LINUX/binary/packaging} + + echo "AGENT_S3_PATH_LINUX=$AGENT_S3_PATH_LINUX" >> "$GITHUB_OUTPUT" + echo "AGENT_S3_PATH_WINDOWS=$AGENT_S3_PATH_WINDOWS" >> "$GITHUB_OUTPUT" + echo "AGENT_S3_PATH_MAC=$AGENT_S3_PATH_MAC" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_NAME=${{ env.CWA_GITHUB_TEST_REPO_NAME }}" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_URL=${{ env.CWA_GITHUB_TEST_REPO_URL }}" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_BRANCH=$CWA_GITHUB_TEST_REPO_BRANCH" >> "$GITHUB_OUTPUT" - name: Echo test variables run: | - echo "AGENT_S3_PATH: ${{ inputs.agent_s3_path }}" + echo "AGENT_S3_PATH_LINUX: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_LINUX }}" + echo "AGENT_S3_PATH_WINDOWS: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_WINDOWS }}" + echo "AGENT_S3_PATH_MAC: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_MAC }}" echo "CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}" echo "CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}" echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" @@ -108,39 +118,15 @@ jobs: id: set-matrix run: | go run --tags=generator generator/test_case_generator.go - echo "ec2_gpu_matrix=$(echo $(cat generator/resources/ec2_gpu_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - echo "eks_addon_matrix=$(echo $(cat generator/resources/eks_addon_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" echo "ec2_linux_matrix=$(echo $(cat generator/resources/ec2_linux_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" echo "ec2_windows_matrix=$(echo $(cat generator/resources/ec2_windows_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" echo "ec2_mac_matrix=$(echo $(cat generator/resources/ec2_mac_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - echo "ec2_performance_matrix=$(echo $(cat generator/resources/ec2_performance_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - echo "ec2_windows_performance_matrix=$(echo $(cat generator/resources/ec2_windows_performance_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - echo "ec2_stress_matrix=$(echo $(cat generator/resources/ec2_stress_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - echo "ec2_windows_stress_matrix=$(echo $(cat generator/resources/ec2_windows_stress_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - echo "ecs_ec2_launch_daemon_matrix=$(echo $(cat generator/resources/ecs_ec2_daemon_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - echo "ecs_fargate_matrix=$(echo $(cat generator/resources/ecs_fargate_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - echo "eks_daemon_matrix=$(echo $(cat generator/resources/eks_daemon_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - echo "eks_deployment_matrix=$(echo $(cat generator/resources/eks_deployment_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - echo "ec2_linux_itar_matrix=$(echo $(cat generator/resources/ec2_linux_itar_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - echo "ec2_linux_china_matrix=$(echo $(cat generator/resources/ec2_linux_china_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - name: Echo test plan matrix run: | - echo "ec2_gpu_matrix: ${{ steps.set-matrix.outputs.ec2_gpu_matrix }}" - echo "eks_addon_matrix: ${{ steps.set-matrix.outputs.eks_addon_matrix }}" echo "ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_matrix }}" echo "ec2_windows_matrix: ${{ steps.set-matrix.outputs.ec2_windows_matrix }}" echo "ec2_mac_matrix: ${{ steps.set-matrix.outputs.ec2_mac_matrix }}" - echo "ec2_performance_matrix: ${{ steps.set-matrix.outputs.ec2_performance_matrix}}" - echo "ec2_windows_performance_matrix: ${{ steps.set-matrix.outputs.ec2_windows_performance_matrix}}" - echo "ec2_stress_matrix: ${{ steps.set-matrix.outputs.ec2_stress_matrix}}" - echo "ec2_windows_stress_matrix: ${{ steps.set-matrix.outputs.ec2_windows_stress_matrix}}" - echo "ecs_ec2_launch_daemon_matrix: ${{ steps.set-matrix.outputs.ecs_ec2_launch_daemon_matrix }}" - echo "ecs_fargate_matrix: ${{ steps.set-matrix.outputs.ecs_fargate_matrix }}" - echo "eks_daemon_matrix: ${{ steps.set-matrix.outputs.eks_daemon_matrix }}" - echo "eks_deployment_matrix: ${{ steps.set-matrix.outputs.eks_deployment_matrix }}" - echo "ec2_linux_itar_matrix: ${{ steps.set-matrix.outputs.ec2_linux_itar_matrix }}" - echo "ec2_linux_china_matrix: ${{ steps.set-matrix.outputs.ec2_linux_china_matrix }}" CloudformationTest: needs: [OutputEnvVariables, GenerateTestMatrix] @@ -176,56 +162,56 @@ jobs: echo s3://${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH }} go test -timeout 1h -package_path=s3://${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent - # StartLocalStack: - # name: 'StartLocalStack' - # needs: [OutputEnvVariables] - # uses: ./.github/workflows/start-localstack.yml - # secrets: inherit - # permissions: - # id-token: write - # contents: read - # with: - # region: us-west-2 - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # github_sha: ${{github.sha}} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} - - # StartLocalStackITAR: - # name: 'StartLocalStackITAR' - # needs: [OutputEnvVariables] - # uses: ./.github/workflows/start-localstack.yml - # secrets: inherit - # permissions: - # id-token: write - # contents: read - # with: - # region: us-gov-east-1 - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # github_sha: ${{github.sha}} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} - - # StartLocalStackCN: - # name: 'StartLocalStackCN' - # needs: [ OutputEnvVariables ] - # uses: ./.github/workflows/start-localstack.yml - # secrets: inherit - # permissions: - # id-token: write - # contents: read - # with: - # region: cn-north-1 - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # github_sha: ${{github.sha}} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + StartLocalStack: + name: 'StartLocalStack' + needs: [OutputEnvVariables] + uses: ./.github/workflows/start-localstack.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + region: us-west-2 + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + github_sha: ${{github.sha}} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + + StartLocalStackITAR: + name: 'StartLocalStackITAR' + needs: [OutputEnvVariables] + uses: ./.github/workflows/start-localstack.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + region: us-gov-east-1 + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + github_sha: ${{github.sha}} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + + StartLocalStackCN: + name: 'StartLocalStackCN' + needs: [ OutputEnvVariables ] + uses: ./.github/workflows/start-localstack.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + region: cn-north-1 + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + github_sha: ${{github.sha}} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} @@ -340,23 +326,26 @@ jobs: # fi # terraform destroy --auto-approve - # EC2LinuxIntegrationTest: - # needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] - # name: 'EC2Linux' - # uses: ./.github/workflows/ec2-integration-test.yml - # with: - # github_sha: ${{github.sha}} - # test_dir: terraform/ec2/linux - # job_id: ec2-linux-integration-test - # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_matrix}} - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} - # region: us-west-2 - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} - # secrets: inherit + EC2LinuxIntegrationTest: + needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + name: 'EC2Linux' + uses: ./.github/workflows/ec2-integration-test.yml + with: + github_sha: ${{github.sha}} + test_dir: terraform/ec2/linux + job_id: ec2-linux-integration-test + test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_matrix}} + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} + region: us-west-2 + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + agent_s3_path_linux: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }} + agent_s3_path_windows: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }} + agent_s3_path_mac: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }} + secrets: inherit # EC2LinuxIntegrationTestITAR: # needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] From 94b3e9308b661436400967f8c515ee5c5130b3b9 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Wed, 5 Feb 2025 14:02:58 -0500 Subject: [PATCH 05/39] Move test repo branch to input argument --- .github/workflows/integration-test-s3.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/integration-test-s3.yml index 423f29ca2c..099b5d42b7 100644 --- a/.github/workflows/integration-test-s3.yml +++ b/.github/workflows/integration-test-s3.yml @@ -26,7 +26,7 @@ on: description: 'The base s3 path for the RPM to run the integration tests for' type: string required: true - test_repo_branch_override: + test_repo_branch: description: 'Override for the test repo branch (default is main)' type: string @@ -59,21 +59,17 @@ jobs: - name: SetOutputs id: set-outputs run: | - CWA_GITHUB_TEST_REPO_BRANCH=${{ env.CWA_GITHUB_TEST_REPO_BRANCH }} - if [ "${{ inputs.test_repo_branch_override }}" != "" ]; then - CWA_GITHUB_TEST_REPO_BRANCH=${{ inputs.test_repo_branch_override }} - fi - AGENT_S3_PATH_LINUX=${{ inputs.agent_s3_path }} AGENT_S3_PATH_WINDOWS=${AGENT_S3_PATH_LINUX/binary/packaging} AGENT_S3_PATH_MAC=${AGENT_S3_PATH_LINUX/binary/packaging} + CWA_GITHUB_TEST_REPO_BRANCH=${{ inputs.test_repo_branch }} echo "AGENT_S3_PATH_LINUX=$AGENT_S3_PATH_LINUX" >> "$GITHUB_OUTPUT" echo "AGENT_S3_PATH_WINDOWS=$AGENT_S3_PATH_WINDOWS" >> "$GITHUB_OUTPUT" echo "AGENT_S3_PATH_MAC=$AGENT_S3_PATH_MAC" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_NAME=${{ env.CWA_GITHUB_TEST_REPO_NAME }}" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_URL=${{ env.CWA_GITHUB_TEST_REPO_URL }}" >> "$GITHUB_OUTPUT" - echo "CWA_GITHUB_TEST_REPO_BRANCH=$CWA_GITHUB_TEST_REPO_BRANCH" >> "$GITHUB_OUTPUT" + echo "CWA_GITHUB_TEST_REPO_BRANCH=${CWA_GITHUB_TEST_REPO_BRANCH:-${{ env.CWA_GITHUB_TEST_REPO_URL }}}" >> "$GITHUB_OUTPUT" - name: Echo test variables run: | From c0ba60759000ab708c846d66fb5e5be11d977b9b Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Wed, 5 Feb 2025 14:08:57 -0500 Subject: [PATCH 06/39] Move checkout after determinig repo branch --- .github/workflows/integration-test-s3.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/integration-test-s3.yml index 099b5d42b7..819ec66227 100644 --- a/.github/workflows/integration-test-s3.yml +++ b/.github/workflows/integration-test-s3.yml @@ -46,16 +46,6 @@ jobs: CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }} CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} steps: - - uses: actions/checkout@v3 - with: - repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} - - - name: Set up Go 1.x - uses: actions/setup-go@v4 - with: - go-version: ~1.22.2 - - name: SetOutputs id: set-outputs run: | @@ -69,7 +59,7 @@ jobs: echo "AGENT_S3_PATH_MAC=$AGENT_S3_PATH_MAC" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_NAME=${{ env.CWA_GITHUB_TEST_REPO_NAME }}" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_URL=${{ env.CWA_GITHUB_TEST_REPO_URL }}" >> "$GITHUB_OUTPUT" - echo "CWA_GITHUB_TEST_REPO_BRANCH=${CWA_GITHUB_TEST_REPO_BRANCH:-${{ env.CWA_GITHUB_TEST_REPO_URL }}}" >> "$GITHUB_OUTPUT" + echo "CWA_GITHUB_TEST_REPO_BRANCH=${CWA_GITHUB_TEST_REPO_BRANCH:-'${{ env.CWA_GITHUB_TEST_REPO_URL }}''}" >> "$GITHUB_OUTPUT" - name: Echo test variables run: | @@ -80,6 +70,16 @@ jobs: echo "CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}" echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" + - uses: actions/checkout@v3 + with: + repository: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }} + ref: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + + - name: Set up Go 1.x + uses: actions/setup-go@v4 + with: + go-version: ~1.22.2 + GenerateTestMatrix: name: 'GenerateTestMatrix' runs-on: ubuntu-latest From 4dfad1588dcaa1e41d2196a4e01a9bd1a9b36e01 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Wed, 5 Feb 2025 14:10:13 -0500 Subject: [PATCH 07/39] Fix default value for test repo branch --- .github/workflows/integration-test-s3.yml | 149 +++++++++++----------- 1 file changed, 74 insertions(+), 75 deletions(-) diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/integration-test-s3.yml index 819ec66227..d9158cf72b 100644 --- a/.github/workflows/integration-test-s3.yml +++ b/.github/workflows/integration-test-s3.yml @@ -59,7 +59,7 @@ jobs: echo "AGENT_S3_PATH_MAC=$AGENT_S3_PATH_MAC" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_NAME=${{ env.CWA_GITHUB_TEST_REPO_NAME }}" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_URL=${{ env.CWA_GITHUB_TEST_REPO_URL }}" >> "$GITHUB_OUTPUT" - echo "CWA_GITHUB_TEST_REPO_BRANCH=${CWA_GITHUB_TEST_REPO_BRANCH:-'${{ env.CWA_GITHUB_TEST_REPO_URL }}''}" >> "$GITHUB_OUTPUT" + echo "CWA_GITHUB_TEST_REPO_BRANCH=${CWA_GITHUB_TEST_REPO_BRANCH:-${{ env.CWA_GITHUB_TEST_REPO_BRANCH }}}" >> "$GITHUB_OUTPUT" - name: Echo test variables run: | @@ -72,7 +72,7 @@ jobs: - uses: actions/checkout@v3 with: - repository: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }} + repository: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }} ref: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - name: Set up Go 1.x @@ -155,59 +155,58 @@ jobs: - name: Test cf run: | cd test/test/cloudformation - echo s3://${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH }} - go test -timeout 1h -package_path=s3://${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent - - StartLocalStack: - name: 'StartLocalStack' - needs: [OutputEnvVariables] - uses: ./.github/workflows/start-localstack.yml - secrets: inherit - permissions: - id-token: write - contents: read - with: - region: us-west-2 - test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} - test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - github_sha: ${{github.sha}} - s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} - - StartLocalStackITAR: - name: 'StartLocalStackITAR' - needs: [OutputEnvVariables] - uses: ./.github/workflows/start-localstack.yml - secrets: inherit - permissions: - id-token: write - contents: read - with: - region: us-gov-east-1 - test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} - test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - github_sha: ${{github.sha}} - s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} - - StartLocalStackCN: - name: 'StartLocalStackCN' - needs: [ OutputEnvVariables ] - uses: ./.github/workflows/start-localstack.yml - secrets: inherit - permissions: - id-token: write - contents: read - with: - region: cn-north-1 - test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} - test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - github_sha: ${{github.sha}} - s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + go test -timeout 1h -package_path=s3://${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent + + # StartLocalStack: + # name: 'StartLocalStack' + # needs: [OutputEnvVariables] + # uses: ./.github/workflows/start-localstack.yml + # secrets: inherit + # permissions: + # id-token: write + # contents: read + # with: + # region: us-west-2 + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # github_sha: ${{github.sha}} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + + # StartLocalStackITAR: + # name: 'StartLocalStackITAR' + # needs: [OutputEnvVariables] + # uses: ./.github/workflows/start-localstack.yml + # secrets: inherit + # permissions: + # id-token: write + # contents: read + # with: + # region: us-gov-east-1 + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # github_sha: ${{github.sha}} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + + # StartLocalStackCN: + # name: 'StartLocalStackCN' + # needs: [ OutputEnvVariables ] + # uses: ./.github/workflows/start-localstack.yml + # secrets: inherit + # permissions: + # id-token: write + # contents: read + # with: + # region: cn-north-1 + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # github_sha: ${{github.sha}} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} @@ -322,26 +321,26 @@ jobs: # fi # terraform destroy --auto-approve - EC2LinuxIntegrationTest: - needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] - name: 'EC2Linux' - uses: ./.github/workflows/ec2-integration-test.yml - with: - github_sha: ${{github.sha}} - test_dir: terraform/ec2/linux - job_id: ec2-linux-integration-test - test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_matrix}} - test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} - region: us-west-2 - terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} - s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} - agent_s3_path_linux: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }} - agent_s3_path_windows: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }} - agent_s3_path_mac: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }} - secrets: inherit + # EC2LinuxIntegrationTest: + # needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + # name: 'EC2Linux' + # uses: ./.github/workflows/ec2-integration-test.yml + # with: + # github_sha: ${{github.sha}} + # test_dir: terraform/ec2/linux + # job_id: ec2-linux-integration-test + # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_matrix}} + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} + # region: us-west-2 + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + # agent_s3_path_linux: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }} + # agent_s3_path_windows: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }} + # agent_s3_path_mac: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }} + # secrets: inherit # EC2LinuxIntegrationTestITAR: # needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] From 4d2c711f3a534cbb0ae3144ac4eec62b70c74b12 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Wed, 5 Feb 2025 14:37:48 -0500 Subject: [PATCH 08/39] Alphabetize the arguments --- .github/workflows/ec2-integration-test.yml | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ec2-integration-test.yml b/.github/workflows/ec2-integration-test.yml index ed7413517a..522f4843c4 100644 --- a/.github/workflows/ec2-integration-test.yml +++ b/.github/workflows/ec2-integration-test.yml @@ -98,29 +98,29 @@ jobs: terraform init if terraform apply --auto-approve \ - -var="ssh_key_value=${{env.PRIVATE_KEY}}" \ - -var="github_test_repo=${{ inputs.test_repo_url }}" \ - -var="test_name=${{ matrix.arrays.os }}" \ - -var="cwa_github_sha=${{inputs.github_sha}}" \ - -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ - -var="github_test_repo_branch=${{inputs.test_repo_branch}}" \ - -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - -var="user=${{ matrix.arrays.username }}" \ + -var="agent_s3_path_linux=${{ inputs.agent_s3_path_linux }}" \ + -var="agent_s3_path_mac=${{ inputs.agent_s3_path_mac }}" \ + -var="agent_s3_path_windows=${{ inputs.agent_s3_path_windows }}" \ + -var="agent_start=${{ matrix.arrays.agentStartCommand }}" \ -var="ami=${{ matrix.arrays.ami }}" \ - -var="ca_cert_path=${{ matrix.arrays.caCertPath }}" \ -var="arc=${{ matrix.arrays.arc }}" \ -var="binary_name=${{ matrix.arrays.binaryName }}" \ + -var="ca_cert_path=${{ matrix.arrays.caCertPath }}" \ + -var="cwa_github_sha=${{inputs.github_sha}}" \ + -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + -var="excluded_tests='${{ matrix.arrays.excludedTests }}'" \ + -var="github_test_repo=${{ inputs.test_repo_url }}" \ + -var="github_test_repo_branch=${{inputs.test_repo_branch}}" \ + -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ -var="local_stack_host_name=${{ inputs.localstack_host }}" \ + -var="plugin_tests='${{ github.event.inputs.plugins }}'" \ -var="region=${{ inputs.region }}" \ -var="s3_bucket=${{ inputs.s3_integration_bucket }}" \ - -var="plugin_tests='${{ github.event.inputs.plugins }}'" \ - -var="excluded_tests='${{ matrix.arrays.excludedTests }}'" \ -var="ssh_key_name=${{env.KEY_NAME}}" \ + -var="ssh_key_value=${{env.PRIVATE_KEY}}" \ -var="test_dir=${{ matrix.arrays.test_dir }}" \ - -var="agent_start=${{ matrix.arrays.agentStartCommand }}" \ - -var="agent_s3_path_linux=${{ inputs.agent_s3_path_linux }} \ - -var="agent_s3_path_windows=${{ inputs.agent_s3_path_windows }} \ - -var="agent_s3_path_mac=${{ inputs.agent_s3_path_mac }}"; then + -var="test_name=${{ matrix.arrays.os }}" \ + -var="user=${{ matrix.arrays.username }}"; then terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" -auto-approve else From 5828cfeed32417227641f524dbd8da8a0931dca8 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Wed, 5 Feb 2025 14:38:04 -0500 Subject: [PATCH 09/39] Enable EC2 Linux integration tests --- .github/workflows/integration-test-s3.yml | 72 +++++++++++------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/integration-test-s3.yml index d9158cf72b..5c0ecd12cd 100644 --- a/.github/workflows/integration-test-s3.yml +++ b/.github/workflows/integration-test-s3.yml @@ -157,22 +157,22 @@ jobs: cd test/test/cloudformation go test -timeout 1h -package_path=s3://${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent - # StartLocalStack: - # name: 'StartLocalStack' - # needs: [OutputEnvVariables] - # uses: ./.github/workflows/start-localstack.yml - # secrets: inherit - # permissions: - # id-token: write - # contents: read - # with: - # region: us-west-2 - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # github_sha: ${{github.sha}} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + StartLocalStack: + name: 'StartLocalStack' + needs: [OutputEnvVariables] + uses: ./.github/workflows/start-localstack.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + region: us-west-2 + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + github_sha: ${{github.sha}} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} # StartLocalStackITAR: # name: 'StartLocalStackITAR' @@ -321,26 +321,26 @@ jobs: # fi # terraform destroy --auto-approve - # EC2LinuxIntegrationTest: - # needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] - # name: 'EC2Linux' - # uses: ./.github/workflows/ec2-integration-test.yml - # with: - # github_sha: ${{github.sha}} - # test_dir: terraform/ec2/linux - # job_id: ec2-linux-integration-test - # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_matrix}} - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} - # region: us-west-2 - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} - # agent_s3_path_linux: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }} - # agent_s3_path_windows: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }} - # agent_s3_path_mac: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }} - # secrets: inherit + EC2LinuxIntegrationTest: + needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + name: 'EC2Linux' + uses: ./.github/workflows/ec2-integration-test.yml + with: + github_sha: ${{github.sha}} + test_dir: terraform/ec2/linux + job_id: ec2-linux-integration-test + test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_matrix}} + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} + region: us-west-2 + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + agent_s3_path_linux: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }} + agent_s3_path_windows: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }} + agent_s3_path_mac: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }} + secrets: inherit # EC2LinuxIntegrationTestITAR: # needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] From b8c14bc08bff4baa6d9ed9952618f25bc29f4f8b Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Wed, 5 Feb 2025 15:28:00 -0500 Subject: [PATCH 10/39] Fix terraform destroy command --- .github/workflows/ec2-integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ec2-integration-test.yml b/.github/workflows/ec2-integration-test.yml index 522f4843c4..bce59791af 100644 --- a/.github/workflows/ec2-integration-test.yml +++ b/.github/workflows/ec2-integration-test.yml @@ -135,4 +135,4 @@ jobs: timeout_minutes: 8 retry_wait_seconds: 5 command: | - command: cd ${{ inputs.test_dir }} && terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" --auto-approve + cd ${{ inputs.test_dir }} && terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" --auto-approve From 296752382794e161d4a36e990cc208100712030d Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Thu, 6 Feb 2025 17:33:28 -0500 Subject: [PATCH 11/39] Enable more tests --- .github/workflows/ec2-integration-test.yml | 1 - .github/workflows/integration-test-s3.yml | 574 +++++++++++---------- 2 files changed, 291 insertions(+), 284 deletions(-) diff --git a/.github/workflows/ec2-integration-test.yml b/.github/workflows/ec2-integration-test.yml index bce59791af..f8bc77d6c8 100644 --- a/.github/workflows/ec2-integration-test.yml +++ b/.github/workflows/ec2-integration-test.yml @@ -121,7 +121,6 @@ jobs: -var="test_dir=${{ matrix.arrays.test_dir }}" \ -var="test_name=${{ matrix.arrays.os }}" \ -var="user=${{ matrix.arrays.username }}"; then - terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" -auto-approve else terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" -auto-approve && exit 1 diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/integration-test-s3.yml index 5c0ecd12cd..1ccf965b2f 100644 --- a/.github/workflows/integration-test-s3.yml +++ b/.github/workflows/integration-test-s3.yml @@ -210,116 +210,119 @@ jobs: - # EC2NvidiaGPUIntegrationTest: - # needs: [ StartLocalStack, GenerateTestMatrix ] - # name: 'EC2NVIDIAGPUIntegrationTest' - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_gpu_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + EC2NvidiaGPUIntegrationTest: + needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + name: 'EC2NVIDIAGPUIntegrationTest' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_gpu_matrix) }} + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + with: + repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} - # - name: Echo Test Info - # run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }} + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 + - name: Echo Test Info + run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }} - # - name: Verify Terraform version - # run: terraform --version + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 - # # nick-fields/retry@v2 starts at base dir - # - name: Terraform apply - # if: ${{ matrix.arrays.family == 'linux' }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 30 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ec2/linux - # fi + - name: Verify Terraform version + run: terraform --version - # terraform init - # if terraform apply --auto-approve \ - # -var="ssh_key_value=${PRIVATE_KEY}" -var="github_test_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ - # -var="test_name=${{ matrix.arrays.os }}" \ - # -var="cwa_github_sha=${GITHUB_SHA}" -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ - # -var="github_test_repo_branch=${{env.CWA_GITHUB_TEST_REPO_BRANCH}}" \ - # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="user=${{ matrix.arrays.username }}" \ - # -var="ami=${{ matrix.arrays.ami }}" \ - # -var="ca_cert_path=${{ matrix.arrays.caCertPath }}" \ - # -var="arc=${{ matrix.arrays.arc }}" \ - # -var="binary_name=${{ matrix.arrays.binaryName }}" \ - # -var="local_stack_host_name=${{ needs.StartLocalStack.outputs.local_stack_host_name }}" \ - # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ - # -var="ssh_key_name=${KEY_NAME}" \ - # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi - # - name: Terraform apply - # if: ${{ matrix.arrays.family == 'window' }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 30 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ec2/win - # fi - # terraform init - # if terraform apply --auto-approve \ - # -var="ssh_key_value=${PRIVATE_KEY}" -var="ssh_key_name=${KEY_NAME}" \ - # -var="github_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ - # -var="cwa_github_sha=${GITHUB_SHA}" -var="ami=${{ matrix.arrays.ami }}" \ - # -var="test_dir=${{ matrix.arrays.test_dir }}" \ - # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="github_test_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ - # -var="github_test_repo_branch=${{env.CWA_GITHUB_TEST_REPO_BRANCH}}" \ - # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" ; then terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi - # #This is here just in case workflow cancel - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # elif if "${{ matrix.arrays.os }}" == window; then - # cd terraform/ec2/win - # else - # cd terraform/ec2/linux - # fi - # terraform destroy --auto-approve + # nick-fields/retry@v2 starts at base dir + - name: Terraform apply + if: ${{ matrix.arrays.family == 'linux' }} + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/ec2/linux + fi + + terraform init + if terraform apply --auto-approve \ + -var="agent_s3_path_linux=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }}" \ + -var="agent_s3_path_mac=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }}" \ + -var="agent_s3_path_windows=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }}" \ + -var="ssh_key_value=${PRIVATE_KEY}" -var="github_test_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ + -var="test_name=${{ matrix.arrays.os }}" \ + -var="cwa_github_sha=${GITHUB_SHA}" -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ + -var="github_test_repo_branch=${{env.CWA_GITHUB_TEST_REPO_BRANCH}}" \ + -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + -var="user=${{ matrix.arrays.username }}" \ + -var="ami=${{ matrix.arrays.ami }}" \ + -var="ca_cert_path=${{ matrix.arrays.caCertPath }}" \ + -var="arc=${{ matrix.arrays.arc }}" \ + -var="binary_name=${{ matrix.arrays.binaryName }}" \ + -var="local_stack_host_name=${{ needs.StartLocalStack.outputs.local_stack_host_name }}" \ + -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + -var="ssh_key_name=${KEY_NAME}" \ + -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve + else + terraform destroy -auto-approve && exit 1 + fi + - name: Terraform apply + if: ${{ matrix.arrays.family == 'window' }} + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/ec2/win + fi + terraform init + if terraform apply --auto-approve \ + -var="ssh_key_value=${PRIVATE_KEY}" -var="ssh_key_name=${KEY_NAME}" \ + -var="github_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ + -var="cwa_github_sha=${GITHUB_SHA}" -var="ami=${{ matrix.arrays.ami }}" \ + -var="test_dir=${{ matrix.arrays.test_dir }}" \ + -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + -var="github_test_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ + -var="github_test_repo_branch=${{env.CWA_GITHUB_TEST_REPO_BRANCH}}" \ + -var="s3_bucket=${S3_INTEGRATION_BUCKET}" ; then terraform destroy -auto-approve + else + terraform destroy -auto-approve && exit 1 + fi + #This is here just in case workflow cancel + - name: Terraform destroy + if: ${{ cancelled() || failure() }} + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 8 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + elif if "${{ matrix.arrays.os }}" == window; then + cd terraform/ec2/win + else + cd terraform/ec2/linux + fi + terraform destroy --auto-approve EC2LinuxIntegrationTest: needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] @@ -379,98 +382,103 @@ jobs: # secrets: inherit - # LinuxOnPremIntegrationTest: - # needs: [StartLocalStack, GenerateTestMatrix, OutputEnvVariables] - # name: 'OnpremLinux' - # uses: ./.github/workflows/ec2-integration-test.yml - # with: - # github_sha: ${{github.sha}} - # test_dir: terraform/ec2/linux_onprem - # job_id: linux-onprem-integration-test - # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_onprem_matrix}} - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} - # region: us-west-2 - # secrets: inherit - - # EC2WinIntegrationTest: - # needs: [GenerateTestMatrix] - # name: 'EC2WinIntegrationTest' - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + LinuxOnPremIntegrationTest: + needs: [StartLocalStack, GenerateTestMatrix, OutputEnvVariables] + name: 'OnpremLinux' + uses: ./.github/workflows/ec2-integration-test.yml + with: + github_sha: ${{github.sha}} + test_dir: terraform/ec2/linux_onprem + job_id: linux-onprem-integration-test + test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_onprem_matrix}} + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} + region: us-west-2 + agent_s3_path_linux: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }} + agent_s3_path_windows: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }} + agent_s3_path_mac: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }} + secrets: inherit - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + EC2WinIntegrationTest: + needs: [OutputEnvVariables, GenerateTestMatrix] + name: 'EC2WinIntegrationTest' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_matrix) }} + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + with: + repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # - name: Echo Test Info - # run: echo run on ec2 instance os ${{ matrix.arrays.os }} use ssm ${{ matrix.arrays.useSSM }} test ${{ matrix.arrays.test_dir }} + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 + - name: Echo Test Info + run: echo run on ec2 instance os ${{ matrix.arrays.os }} use ssm ${{ matrix.arrays.useSSM }} test ${{ matrix.arrays.test_dir }} - # - name: Verify Terraform version - # run: terraform --version + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 - # # nick-fields/retry@v2 starts at base dir - # - name: Terraform apply - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 30 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ec2/win - # fi - # terraform init - # if terraform apply --auto-approve \ - # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="ssh_key_value=${PRIVATE_KEY}" -var="ssh_key_name=${KEY_NAME}" \ - # -var="test_name=${{ matrix.arrays.os }}" \ - # -var="cwa_github_sha=${GITHUB_SHA}" \ - # -var="test_dir=${{ matrix.arrays.test_dir }}" \ - # -var="ami=${{ matrix.arrays.ami }}" \ - # -var="use_ssm=${{ matrix.arrays.useSSM }}" \ - # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" ; then - # terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi + - name: Verify Terraform version + run: terraform --version - # #This is here just in case workflow cancel - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ec2/win - # fi - # terraform destroy --auto-approve + # nick-fields/retry@v2 starts at base dir + - name: Terraform apply + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/ec2/win + fi + terraform init + if terraform apply --auto-approve \ + -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + -var="ssh_key_value=${PRIVATE_KEY}" \ + -var="ssh_key_name=${KEY_NAME}" \ + -var="test_name=${{ matrix.arrays.os }}" \ + -var="cwa_github_sha=${GITHUB_SHA}" \ + -var="test_dir=${{ matrix.arrays.test_dir }}" \ + -var="ami=${{ matrix.arrays.ami }}" \ + -var="use_ssm=${{ matrix.arrays.useSSM }}" \ + -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + -var="agent_s3_path_windows=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }}"; then + terraform destroy -auto-approve + else + terraform destroy -auto-approve && exit 1 + fi + + #This is here just in case workflow cancel + - name: Terraform destroy + if: ${{ cancelled() || failure() }} + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 8 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/ec2/win + fi + terraform destroy --auto-approve # EC2DarwinIntegrationTest: # needs: [GenerateTestMatrix] @@ -1147,99 +1155,99 @@ jobs: # retry_wait_seconds: 5 # command: cd terraform/stress && terraform destroy --auto-approve - # GPUEndToEndTest: - # name: "GPU E2E Test" - # needs: [ GenerateTestMatrix, OutputEnvVariables ] - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.eks_addon_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 + GPUEndToEndTest: + name: "GPU E2E Test" + needs: [ GenerateTestMatrix, OutputEnvVariables ] + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.eks_addon_matrix) }} + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + with: + repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} - # - name: Verify Terraform version - # run: terraform --version + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - # - name: Terraform apply and setup - # run: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/eks/addon/gpu - # fi - - # terraform init - # if terraform apply --auto-approve \ - # -var="beta=true" \ - # -var="ami_type=${{ matrix.arrays.ami }}" \ - # -var="instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="k8s_version=${{ matrix.arrays.k8sVersion }}"; then - # echo "Terraform apply successful." - - # # Capture the output - # echo "Getting EKS cluster name" - # EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) - # echo "Cluster name is ${EKS_CLUSTER_NAME}" - # kubectl create -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.17.0/deployments/static/nvidia-device-plugin.yml - # kubectl patch amazoncloudwatchagents -n amazon-cloudwatch cloudwatch-agent --type='json' -p='[{"op": "replace", "path": "/spec/image", "value": ${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/${{ env.ECR_INTEGRATION_TEST_REPO }}:${{ github.sha }}}]' - # # wait nvidia device plugin to be ready - # sleep 10 - # kubectl apply -f ./gpuBurner.yaml - # else - # terraform destroy -auto-approve && exit 1 - # fi - - # - name: Run Go tests with retry - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 5 - # timeout_minutes: 60 - # retry_wait_seconds: 30 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/eks/addon/gpu - # fi - # echo "Getting EKS cluster name" - # EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) - # echo "Cluster name is ${EKS_CLUSTER_NAME}" + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 - # if go test ${{ matrix.arrays.test_dir }} -eksClusterName ${EKS_CLUSTER_NAME} -computeType=EKS -v -eksDeploymentStrategy=DAEMON -eksGpuType=nvidia -useE2EMetrics; then - # echo "Tests passed" - # else - # echo "Tests failed" - # exit 1 - # fi + - name: Verify Terraform version + run: terraform --version - # - name: Terraform destroy - # if: always() - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/eks/addon/gpu - # fi - # terraform destroy -auto-approve + - name: Terraform apply and setup + run: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/eks/addon/gpu + fi + + terraform init + if terraform apply --auto-approve \ + -var="beta=true" \ + -var="ami_type=${{ matrix.arrays.ami }}" \ + -var="instance_type=${{ matrix.arrays.instanceType }}" \ + -var="k8s_version=${{ matrix.arrays.k8sVersion }}"; then + echo "Terraform apply successful." + + # Capture the output + echo "Getting EKS cluster name" + EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) + echo "Cluster name is ${EKS_CLUSTER_NAME}" + kubectl create -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.17.0/deployments/static/nvidia-device-plugin.yml + kubectl patch amazoncloudwatchagents -n amazon-cloudwatch cloudwatch-agent --type='json' -p='[{"op": "replace", "path": "/spec/image", "value": ${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/${{ env.ECR_INTEGRATION_TEST_REPO }}:${{ github.sha }}}]' + # wait nvidia device plugin to be ready + sleep 10 + kubectl apply -f ./gpuBurner.yaml + else + terraform destroy -auto-approve && exit 1 + fi + + - name: Run Go tests with retry + uses: nick-fields/retry@v2 + with: + max_attempts: 5 + timeout_minutes: 60 + retry_wait_seconds: 30 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/eks/addon/gpu + fi + echo "Getting EKS cluster name" + EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) + echo "Cluster name is ${EKS_CLUSTER_NAME}" + + if go test ${{ matrix.arrays.test_dir }} -eksClusterName ${EKS_CLUSTER_NAME} -computeType=EKS -v -eksDeploymentStrategy=DAEMON -eksGpuType=nvidia -useE2EMetrics; then + echo "Tests passed" + else + echo "Tests failed" + exit 1 + fi + + - name: Terraform destroy + if: always() + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 8 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/eks/addon/gpu + fi + terraform destroy -auto-approve From 249d1e17a96cdd50c60719179795ddc6ac03358e Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Fri, 7 Feb 2025 09:23:09 -0500 Subject: [PATCH 12/39] use build release ID inplace of github sha --- .github/workflows/ec2-integration-test.yml | 13 +- .github/workflows/integration-test-s3.yml | 716 +++++----- .github/workflows/integration-test.yml | 4 +- .github/workflows/release-candidate-test.yml | 1235 ++++++++++++++++++ 4 files changed, 1586 insertions(+), 382 deletions(-) create mode 100644 .github/workflows/release-candidate-test.yml diff --git a/.github/workflows/ec2-integration-test.yml b/.github/workflows/ec2-integration-test.yml index f8bc77d6c8..1c6f04ce66 100644 --- a/.github/workflows/ec2-integration-test.yml +++ b/.github/workflows/ec2-integration-test.yml @@ -11,7 +11,7 @@ env: on: workflow_call: inputs: - github_sha: + build_id: required: true type: string test_repo_name: @@ -40,12 +40,6 @@ on: type: string s3_integration_bucket: type: string - agent_s3_path_linux: - type: string - agent_s3_path_windows: - type: string - agent_s3_path_mac: - type: string jobs: EC2IntegrationTest: @@ -98,15 +92,12 @@ jobs: terraform init if terraform apply --auto-approve \ - -var="agent_s3_path_linux=${{ inputs.agent_s3_path_linux }}" \ - -var="agent_s3_path_mac=${{ inputs.agent_s3_path_mac }}" \ - -var="agent_s3_path_windows=${{ inputs.agent_s3_path_windows }}" \ -var="agent_start=${{ matrix.arrays.agentStartCommand }}" \ -var="ami=${{ matrix.arrays.ami }}" \ -var="arc=${{ matrix.arrays.arc }}" \ -var="binary_name=${{ matrix.arrays.binaryName }}" \ -var="ca_cert_path=${{ matrix.arrays.caCertPath }}" \ - -var="cwa_github_sha=${{inputs.github_sha}}" \ + -var="cwa_github_sha=${{inputs.build_id}}" \ -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ -var="excluded_tests='${{ matrix.arrays.excludedTests }}'" \ -var="github_test_repo=${{ inputs.test_repo_url }}" \ diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/integration-test-s3.yml index 1ccf965b2f..fb47ef6b33 100644 --- a/.github/workflows/integration-test-s3.yml +++ b/.github/workflows/integration-test-s3.yml @@ -22,8 +22,8 @@ env: on: workflow_dispatch: inputs: - agent_s3_path: - description: 'The base s3 path for the RPM to run the integration tests for' + build_id: + description: 'The build ID (release candidate build number or GitHub commit SHA)' type: string required: true test_repo_branch: @@ -39,9 +39,6 @@ jobs: name: 'OutputEnvVariables' runs-on: ubuntu-latest outputs: - AGENT_S3_PATH_LINUX: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_LINUX }} - AGENT_S3_PATH_WINDOWS: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_WINDOWS }} - AGENT_S3_PATH_MAC: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_MAC }} CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }} CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }} CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} @@ -49,23 +46,14 @@ jobs: - name: SetOutputs id: set-outputs run: | - AGENT_S3_PATH_LINUX=${{ inputs.agent_s3_path }} - AGENT_S3_PATH_WINDOWS=${AGENT_S3_PATH_LINUX/binary/packaging} - AGENT_S3_PATH_MAC=${AGENT_S3_PATH_LINUX/binary/packaging} CWA_GITHUB_TEST_REPO_BRANCH=${{ inputs.test_repo_branch }} - echo "AGENT_S3_PATH_LINUX=$AGENT_S3_PATH_LINUX" >> "$GITHUB_OUTPUT" - echo "AGENT_S3_PATH_WINDOWS=$AGENT_S3_PATH_WINDOWS" >> "$GITHUB_OUTPUT" - echo "AGENT_S3_PATH_MAC=$AGENT_S3_PATH_MAC" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_NAME=${{ env.CWA_GITHUB_TEST_REPO_NAME }}" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_URL=${{ env.CWA_GITHUB_TEST_REPO_URL }}" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_BRANCH=${CWA_GITHUB_TEST_REPO_BRANCH:-${{ env.CWA_GITHUB_TEST_REPO_BRANCH }}}" >> "$GITHUB_OUTPUT" - name: Echo test variables run: | - echo "AGENT_S3_PATH_LINUX: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_LINUX }}" - echo "AGENT_S3_PATH_WINDOWS: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_WINDOWS }}" - echo "AGENT_S3_PATH_MAC: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_MAC }}" echo "CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}" echo "CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}" echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" @@ -100,16 +88,6 @@ jobs: 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: - repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} - - - name: Set up Go 1.x - uses: actions/setup-go@v4 - with: - go-version: ~1.22.2 - - name: Generate matrix id: set-matrix run: | @@ -136,8 +114,8 @@ jobs: steps: - uses: actions/checkout@v3 with: - repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} path: test - name: Set up Go 1.x @@ -155,7 +133,7 @@ jobs: - name: Test cf run: | cd test/test/cloudformation - go test -timeout 1h -package_path=s3://${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent + go test -timeout 1h -package_path=s3://${{ vars.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_sha }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent StartLocalStack: name: 'StartLocalStack' @@ -171,7 +149,7 @@ jobs: test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - github_sha: ${{github.sha}} + github_sha: ${{inputs.build_id}} s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} # StartLocalStackITAR: @@ -188,7 +166,7 @@ jobs: # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # github_sha: ${{github.sha}} + # github_sha: ${{inputs.build_id}} # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} # StartLocalStackCN: @@ -205,144 +183,141 @@ jobs: # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # github_sha: ${{github.sha}} + # github_sha: ${{inputs.build_id}} # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} - EC2NvidiaGPUIntegrationTest: - needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] - name: 'EC2NVIDIAGPUIntegrationTest' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_gpu_matrix) }} - permissions: - id-token: write - contents: read - steps: - - uses: actions/checkout@v3 - with: - repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + # EC2NvidiaGPUIntegrationTest: + # needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + # name: 'EC2NVIDIAGPUIntegrationTest' + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_gpu_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - aws-region: us-west-2 - role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - name: Echo Test Info - run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }} + # - name: Echo Test Info + # run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }} - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 - - name: Verify Terraform version - run: terraform --version + # - name: Verify Terraform version + # run: terraform --version - # nick-fields/retry@v2 starts at base dir - - name: Terraform apply - if: ${{ matrix.arrays.family == 'linux' }} - uses: nick-fields/retry@v2 - with: - max_attempts: 3 - timeout_minutes: 30 - retry_wait_seconds: 5 - command: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - else - cd terraform/ec2/linux - fi - - terraform init - if terraform apply --auto-approve \ - -var="agent_s3_path_linux=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }}" \ - -var="agent_s3_path_mac=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }}" \ - -var="agent_s3_path_windows=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }}" \ - -var="ssh_key_value=${PRIVATE_KEY}" -var="github_test_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ - -var="test_name=${{ matrix.arrays.os }}" \ - -var="cwa_github_sha=${GITHUB_SHA}" -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ - -var="github_test_repo_branch=${{env.CWA_GITHUB_TEST_REPO_BRANCH}}" \ - -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - -var="user=${{ matrix.arrays.username }}" \ - -var="ami=${{ matrix.arrays.ami }}" \ - -var="ca_cert_path=${{ matrix.arrays.caCertPath }}" \ - -var="arc=${{ matrix.arrays.arc }}" \ - -var="binary_name=${{ matrix.arrays.binaryName }}" \ - -var="local_stack_host_name=${{ needs.StartLocalStack.outputs.local_stack_host_name }}" \ - -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ - -var="ssh_key_name=${KEY_NAME}" \ - -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve - else - terraform destroy -auto-approve && exit 1 - fi - - name: Terraform apply - if: ${{ matrix.arrays.family == 'window' }} - uses: nick-fields/retry@v2 - with: - max_attempts: 3 - timeout_minutes: 30 - retry_wait_seconds: 5 - command: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - else - cd terraform/ec2/win - fi - terraform init - if terraform apply --auto-approve \ - -var="ssh_key_value=${PRIVATE_KEY}" -var="ssh_key_name=${KEY_NAME}" \ - -var="github_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ - -var="cwa_github_sha=${GITHUB_SHA}" -var="ami=${{ matrix.arrays.ami }}" \ - -var="test_dir=${{ matrix.arrays.test_dir }}" \ - -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - -var="github_test_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ - -var="github_test_repo_branch=${{env.CWA_GITHUB_TEST_REPO_BRANCH}}" \ - -var="s3_bucket=${S3_INTEGRATION_BUCKET}" ; then terraform destroy -auto-approve - else - terraform destroy -auto-approve && exit 1 - fi - #This is here just in case workflow cancel - - name: Terraform destroy - if: ${{ cancelled() || failure() }} - uses: nick-fields/retry@v2 - with: - max_attempts: 3 - timeout_minutes: 8 - retry_wait_seconds: 5 - command: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - elif if "${{ matrix.arrays.os }}" == window; then - cd terraform/ec2/win - else - cd terraform/ec2/linux - fi - terraform destroy --auto-approve + # # nick-fields/retry@v2 starts at base dir + # - name: Terraform apply + # if: ${{ matrix.arrays.family == 'linux' }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 30 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/linux + # fi + + # terraform init + # if terraform apply --auto-approve \ + # -var="agent_s3_path_linux=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }}" \ + # -var="agent_s3_path_mac=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }}" \ + # -var="agent_s3_path_windows=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }}" \ + # -var="ssh_key_value=${PRIVATE_KEY}" -var="github_test_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ + # -var="test_name=${{ matrix.arrays.os }}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ + # -var="github_test_repo_branch=${{env.CWA_GITHUB_TEST_REPO_BRANCH}}" \ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="user=${{ matrix.arrays.username }}" \ + # -var="ami=${{ matrix.arrays.ami }}" \ + # -var="ca_cert_path=${{ matrix.arrays.caCertPath }}" \ + # -var="arc=${{ matrix.arrays.arc }}" \ + # -var="binary_name=${{ matrix.arrays.binaryName }}" \ + # -var="local_stack_host_name=${{ needs.StartLocalStack.outputs.local_stack_host_name }}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + # -var="ssh_key_name=${KEY_NAME}" \ + # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + # - name: Terraform apply + # if: ${{ matrix.arrays.family == 'window' }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 30 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/win + # fi + # terraform init + # if terraform apply --auto-approve \ + # -var="ssh_key_value=${PRIVATE_KEY}" -var="ssh_key_name=${KEY_NAME}" \ + # -var="github_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" -var="ami=${{ matrix.arrays.ami }}" \ + # -var="test_dir=${{ matrix.arrays.test_dir }}" \ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="github_test_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ + # -var="github_test_repo_branch=${{env.CWA_GITHUB_TEST_REPO_BRANCH}}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" ; then terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + # #This is here just in case workflow cancel + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # elif if "${{ matrix.arrays.os }}" == window; then + # cd terraform/ec2/win + # else + # cd terraform/ec2/linux + # fi + # terraform destroy --auto-approve EC2LinuxIntegrationTest: needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] name: 'EC2Linux' uses: ./.github/workflows/ec2-integration-test.yml with: - github_sha: ${{github.sha}} + build_id: ${{ inputs.build_id }} test_dir: terraform/ec2/linux job_id: ec2-linux-integration-test - test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_matrix}} + test_props: ${{ needs.GenerateTestMatrix.outputs.ec2_linux_matrix }} test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} + localstack_host: ${{ needs.StartLocalStack.outputs.local_stack_host_name }} region: us-west-2 terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} - agent_s3_path_linux: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }} - agent_s3_path_windows: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }} - agent_s3_path_mac: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }} secrets: inherit # EC2LinuxIntegrationTestITAR: @@ -350,7 +325,7 @@ jobs: # name: 'EC2LinuxITAR' # uses: ./.github/workflows/ec2-integration-test.yml # with: - # github_sha: ${{github.sha}} + # github_sha: ${{inputs.build_id}} # test_dir: terraform/ec2/linux # job_id: ec2-linux-integration-test # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_itar_matrix}} @@ -368,7 +343,7 @@ jobs: # name: 'EC2LinuxCN' # uses: ./.github/workflows/ec2-integration-test.yml # with: - # github_sha: ${{github.sha}} + # github_sha: ${{inputs.build_id}} # test_dir: terraform/ec2/linux # job_id: ec2-linux-integration-test # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_china_matrix}} @@ -382,106 +357,105 @@ jobs: # secrets: inherit - LinuxOnPremIntegrationTest: - needs: [StartLocalStack, GenerateTestMatrix, OutputEnvVariables] - name: 'OnpremLinux' - uses: ./.github/workflows/ec2-integration-test.yml - with: - github_sha: ${{github.sha}} - test_dir: terraform/ec2/linux_onprem - job_id: linux-onprem-integration-test - test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_onprem_matrix}} - test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} - region: us-west-2 - agent_s3_path_linux: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }} - agent_s3_path_windows: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }} - agent_s3_path_mac: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }} - secrets: inherit + # LinuxOnPremIntegrationTest: + # needs: [StartLocalStack, GenerateTestMatrix, OutputEnvVariables] + # name: 'OnpremLinux' + # uses: ./.github/workflows/ec2-integration-test.yml + # with: + # github_sha: ${{inputs.build_id}} + # test_dir: terraform/ec2/linux_onprem + # job_id: linux-onprem-integration-test + # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_onprem_matrix}} + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} + # region: us-west-2 + # agent_s3_path_linux: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }} + # agent_s3_path_windows: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }} + # agent_s3_path_mac: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }} + # secrets: inherit - EC2WinIntegrationTest: - needs: [OutputEnvVariables, GenerateTestMatrix] - name: 'EC2WinIntegrationTest' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_matrix) }} - permissions: - id-token: write - contents: read - steps: - - uses: actions/checkout@v3 - with: - repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # EC2WinIntegrationTest: + # needs: [OutputEnvVariables, GenerateTestMatrix] + # name: 'EC2WinIntegrationTest' + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - aws-region: us-west-2 - role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - name: Echo Test Info - run: echo run on ec2 instance os ${{ matrix.arrays.os }} use ssm ${{ matrix.arrays.useSSM }} test ${{ matrix.arrays.test_dir }} + # - name: Echo Test Info + # run: echo run on ec2 instance os ${{ matrix.arrays.os }} use ssm ${{ matrix.arrays.useSSM }} test ${{ matrix.arrays.test_dir }} - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 - - name: Verify Terraform version - run: terraform --version + # - name: Verify Terraform version + # run: terraform --version - # nick-fields/retry@v2 starts at base dir - - name: Terraform apply - uses: nick-fields/retry@v2 - with: - max_attempts: 3 - timeout_minutes: 30 - retry_wait_seconds: 5 - command: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - else - cd terraform/ec2/win - fi - terraform init - if terraform apply --auto-approve \ - -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - -var="ssh_key_value=${PRIVATE_KEY}" \ - -var="ssh_key_name=${KEY_NAME}" \ - -var="test_name=${{ matrix.arrays.os }}" \ - -var="cwa_github_sha=${GITHUB_SHA}" \ - -var="test_dir=${{ matrix.arrays.test_dir }}" \ - -var="ami=${{ matrix.arrays.ami }}" \ - -var="use_ssm=${{ matrix.arrays.useSSM }}" \ - -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ - -var="agent_s3_path_windows=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }}"; then - terraform destroy -auto-approve - else - terraform destroy -auto-approve && exit 1 - fi - - #This is here just in case workflow cancel - - name: Terraform destroy - if: ${{ cancelled() || failure() }} - uses: nick-fields/retry@v2 - with: - max_attempts: 3 - timeout_minutes: 8 - retry_wait_seconds: 5 - command: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - else - cd terraform/ec2/win - fi - terraform destroy --auto-approve + # # nick-fields/retry@v2 starts at base dir + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 30 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/win + # fi + # terraform init + # if terraform apply --auto-approve \ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="ssh_key_value=${PRIVATE_KEY}" \ + # -var="ssh_key_name=${KEY_NAME}" \ + # -var="test_name=${{ matrix.arrays.os }}" \ + # -var="cwa_github_sha= ${{ inputs.build_id }}" \ + # -var="test_dir=${{ matrix.arrays.test_dir }}" \ + # -var="ami=${{ matrix.arrays.ami }}" \ + # -var="use_ssm=${{ matrix.arrays.useSSM }}" \ + # -var="s3_bucket=${{ vars.S3_INTEGRATION_BUCKET }}" \ + # terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # #This is here just in case workflow cancel + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/win + # fi + # terraform destroy --auto-approve # EC2DarwinIntegrationTest: - # needs: [GenerateTestMatrix] + # needs: [GenerateTestMatrix, OutputEnvVariables] # name: 'EC2DarwinIntegrationTest' # runs-on: ubuntu-latest # strategy: @@ -494,8 +468,8 @@ jobs: # steps: # - uses: actions/checkout@v3 # with: - # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} # - name: Configure AWS Credentials # uses: aws-actions/configure-aws-credentials@v2 @@ -534,7 +508,8 @@ jobs: # -var="cwa_github_sha=${GITHUB_SHA}" -var="ami=${{ matrix.arrays.ami }}" \ # -var="test_dir=${{ matrix.arrays.test_dir }}" \ # -var="license_manager_arn=${{ env.LICENSE_MANAGER_ARN }}" \ - # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" ; then + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + # -var="agent_s3_path_mac=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }}; then # terraform destroy -auto-approve # else # terraform destroy -auto-approve && exit 1 @@ -556,22 +531,22 @@ jobs: # fi # terraform destroy --auto-approve - # StopLocalStack: - # name: 'StopLocalStack' - # if: ${{ always() && needs.StartLocalStack.result == 'success' }} - # needs: [ StartLocalStack, EC2LinuxIntegrationTest, LinuxOnPremIntegrationTest, OutputEnvVariables ] - # uses: ./.github/workflows/stop-localstack.yml - # secrets: inherit - # permissions: - # id-token: write - # contents: read - # with: - # region: us-west-2 - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} - # github_sha: ${{github.sha}} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + StopLocalStack: + name: 'StopLocalStack' + if: ${{ always() && needs.StartLocalStack.result == 'success' }} + needs: [ StartLocalStack, EC2LinuxIntegrationTest, OutputEnvVariables ] + uses: ./.github/workflows/stop-localstack.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + region: us-west-2 + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + github_sha: ${{inputs.build_id}} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} # StopLocalStackITAR: # name: 'StopLocalStackITAR' @@ -587,7 +562,7 @@ jobs: # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} - # github_sha: ${{github.sha}} + # github_sha: ${{inputs.build_id}} # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} # StopLocalStackCN: @@ -604,7 +579,7 @@ jobs: # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} - # github_sha: ${{github.sha}} + # github_sha: ${{inputs.build_id}} # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} # ECSEC2IntegrationTest: @@ -621,8 +596,8 @@ jobs: # steps: # - uses: actions/checkout@v3 # with: - # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} # - name: Configure AWS Credentials # uses: aws-actions/configure-aws-credentials@v2 @@ -659,7 +634,7 @@ jobs: # -var="test_dir=${{ matrix.arrays.test_dir }}"\ # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ - # -var="cwagent_image_tag=${{ github.sha }}"\ + # -var="cwagent_image_tag=${{ inputs.build_id }}"\ # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ # -var="metadataEnabled=${{ matrix.arrays.metadataEnabled }}" \ # -var="ami=${{ matrix.arrays.ami }}" ; then @@ -686,7 +661,7 @@ jobs: # ECSFargateIntegrationTest: # name: 'ECSFargateIntegrationTest' # runs-on: ubuntu-latest - # needs: [GenerateTestMatrix] + # needs: [GenerateTestMatrix, OutputEnvVariables] # strategy: # fail-fast: false # matrix: @@ -697,8 +672,8 @@ jobs: # steps: # - uses: actions/checkout@v3 # with: - # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} # - name: Configure AWS Credentials # uses: aws-actions/configure-aws-credentials@v2 @@ -734,7 +709,7 @@ jobs: # if terraform apply --auto-approve\ # -var="test_dir=${{ matrix.arrays.test_dir }}"\ # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ - # -var="cwagent_image_tag=${{ github.sha }}"; then + # -var="cwagent_image_tag=${{ inputs.build_id }}"; then # terraform destroy -auto-approve # else # terraform destroy -auto-approve && exit 1 @@ -757,7 +732,7 @@ jobs: # EKSIntegrationTest: # name: 'EKSIntegrationTest' # runs-on: ubuntu-latest - # needs: [ GenerateTestMatrix ] + # needs: [ GenerateTestMatrix, OutputEnvVariables ] # strategy: # fail-fast: false # matrix: @@ -768,8 +743,8 @@ jobs: # steps: # - uses: actions/checkout@v3 # with: - # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} # - name: Configure AWS Credentials # uses: aws-actions/configure-aws-credentials@v2 @@ -805,7 +780,7 @@ jobs: # if terraform apply --auto-approve \ # -var="test_dir=${{ matrix.arrays.test_dir }}"\ # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \ - # -var="cwagent_image_tag=${{ github.sha }}" \ + # -var="cwagent_image_tag=${{ inputs.build_id }}" \ # -var="ami_type=${{ matrix.arrays.ami }}" \ # -var="instance_type=${{ matrix.arrays.instanceType }}" \ # -var="k8s_version=${{ matrix.arrays.k8sVersion }}"; then @@ -832,7 +807,7 @@ jobs: # EKSPrometheusIntegrationTest: # name: 'EKSPrometheusIntegrationTest' # runs-on: ubuntu-latest - # needs: [ GenerateTestMatrix ] + # needs: [ GenerateTestMatrix, OutputEnvVariables ] # strategy: # fail-fast: false # matrix: @@ -843,8 +818,8 @@ jobs: # steps: # - uses: actions/checkout@v3 # with: - # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} # - name: Configure AWS Credentials # uses: aws-actions/configure-aws-credentials@v2 @@ -880,7 +855,7 @@ jobs: # if terraform apply --auto-approve \ # -var="test_dir=${{ matrix.arrays.test_dir }}"\ # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \ - # -var="cwagent_image_tag=${{ github.sha }}" \ + # -var="cwagent_image_tag=${{ inputs.build_id }}" \ # -var="k8s_version=${{ matrix.arrays.k8s_version }}"; then # terraform destroy -auto-approve # else @@ -904,7 +879,7 @@ jobs: # PerformanceTrackingTest: # name: "PerformanceTrackingTest" - # needs: [GenerateTestMatrix] + # needs: [GenerateTestMatrix, OutputEnvVariables] # runs-on: ubuntu-latest # strategy: # fail-fast: false @@ -916,8 +891,8 @@ jobs: # steps: # - uses: actions/checkout@v3 # with: - # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} # - name: Configure AWS Credentials # uses: aws-actions/configure-aws-credentials@v2 @@ -942,6 +917,9 @@ jobs: # cd terraform/performance # terraform init # if terraform apply --auto-approve \ + # -var="agent_s3_path_linux=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }}" \ + # -var="agent_s3_path_mac=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }}" \ + # -var="agent_s3_path_windows=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }}" \ # -var="ssh_key_value=${PRIVATE_KEY}" \ # -var="cwa_github_sha=${GITHUB_SHA}" \ # -var="ami=${{ matrix.arrays.ami }}" \ @@ -1155,99 +1133,99 @@ jobs: # retry_wait_seconds: 5 # command: cd terraform/stress && terraform destroy --auto-approve - GPUEndToEndTest: - name: "GPU E2E Test" - needs: [ GenerateTestMatrix, OutputEnvVariables ] - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.eks_addon_matrix) }} - permissions: - id-token: write - contents: read - steps: - - uses: actions/checkout@v3 - with: - repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + # GPUEndToEndTest: + # name: "GPU E2E Test" + # needs: [ GenerateTestMatrix, OutputEnvVariables ] + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.eks_addon_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - aws-region: us-west-2 - role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 - - name: Verify Terraform version - run: terraform --version + # - name: Verify Terraform version + # run: terraform --version - - name: Terraform apply and setup - run: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - else - cd terraform/eks/addon/gpu - fi - - terraform init - if terraform apply --auto-approve \ - -var="beta=true" \ - -var="ami_type=${{ matrix.arrays.ami }}" \ - -var="instance_type=${{ matrix.arrays.instanceType }}" \ - -var="k8s_version=${{ matrix.arrays.k8sVersion }}"; then - echo "Terraform apply successful." - - # Capture the output - echo "Getting EKS cluster name" - EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) - echo "Cluster name is ${EKS_CLUSTER_NAME}" - kubectl create -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.17.0/deployments/static/nvidia-device-plugin.yml - kubectl patch amazoncloudwatchagents -n amazon-cloudwatch cloudwatch-agent --type='json' -p='[{"op": "replace", "path": "/spec/image", "value": ${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/${{ env.ECR_INTEGRATION_TEST_REPO }}:${{ github.sha }}}]' - # wait nvidia device plugin to be ready - sleep 10 - kubectl apply -f ./gpuBurner.yaml - else - terraform destroy -auto-approve && exit 1 - fi - - - name: Run Go tests with retry - uses: nick-fields/retry@v2 - with: - max_attempts: 5 - timeout_minutes: 60 - retry_wait_seconds: 30 - command: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - else - cd terraform/eks/addon/gpu - fi - echo "Getting EKS cluster name" - EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) - echo "Cluster name is ${EKS_CLUSTER_NAME}" - - if go test ${{ matrix.arrays.test_dir }} -eksClusterName ${EKS_CLUSTER_NAME} -computeType=EKS -v -eksDeploymentStrategy=DAEMON -eksGpuType=nvidia -useE2EMetrics; then - echo "Tests passed" - else - echo "Tests failed" - exit 1 - fi - - - name: Terraform destroy - if: always() - uses: nick-fields/retry@v2 - with: - max_attempts: 3 - timeout_minutes: 8 - retry_wait_seconds: 5 - command: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - else - cd terraform/eks/addon/gpu - fi - terraform destroy -auto-approve + # - name: Terraform apply and setup + # run: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/addon/gpu + # fi + + # terraform init + # if terraform apply --auto-approve \ + # -var="beta=true" \ + # -var="ami_type=${{ matrix.arrays.ami }}" \ + # -var="instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="k8s_version=${{ matrix.arrays.k8sVersion }}"; then + # echo "Terraform apply successful." + + # # Capture the output + # echo "Getting EKS cluster name" + # EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) + # echo "Cluster name is ${EKS_CLUSTER_NAME}" + # kubectl create -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.17.0/deployments/static/nvidia-device-plugin.yml + # kubectl patch amazoncloudwatchagents -n amazon-cloudwatch cloudwatch-agent --type='json' -p='[{"op": "replace", "path": "/spec/image", "value": ${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/${{ env.ECR_INTEGRATION_TEST_REPO }}:${{ inputs.build_id }}}]' + # # wait nvidia device plugin to be ready + # sleep 10 + # kubectl apply -f ./gpuBurner.yaml + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Run Go tests with retry + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 5 + # timeout_minutes: 60 + # retry_wait_seconds: 30 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/addon/gpu + # fi + # echo "Getting EKS cluster name" + # EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) + # echo "Cluster name is ${EKS_CLUSTER_NAME}" + + # if go test ${{ matrix.arrays.test_dir }} -eksClusterName ${EKS_CLUSTER_NAME} -computeType=EKS -v -eksDeploymentStrategy=DAEMON -eksGpuType=nvidia -useE2EMetrics; then + # echo "Tests passed" + # else + # echo "Tests failed" + # exit 1 + # fi + + # - name: Terraform destroy + # if: always() + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/addon/gpu + # fi + # terraform destroy -auto-approve diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 32eac385d6..4a54968bf7 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -26,7 +26,7 @@ on: description: 'The ID of the build-test-artifacts workflow run' type: number required: true - build_sha: + build_id: description: 'The SHA of the build-test-artifacts workflow run' type: string required: true @@ -157,7 +157,7 @@ jobs: - name: Test cf run: | cd test/test/cloudformation - go test -timeout 1h -package_path=s3://${S3_INTEGRATION_BUCKET}/integration-test/binary/${{ github.sha }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent + go test -timeout 1h -package_path=s3://${S3_INTEGRATION_BUCKET}/integration-test/binary/${{ inputs.build_sha }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent StartLocalStack: name: 'StartLocalStack' diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml new file mode 100644 index 0000000000..40d9bc139b --- /dev/null +++ b/.github/workflows/release-candidate-test.yml @@ -0,0 +1,1235 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: MIT + +name: Run Integration Tests for Release Candidate +env: + PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY }} + TERRAFORM_AWS_ASSUME_ROLE: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + TERRAFORM_AWS_ASSUME_ROLE_DURATION: 14400 # 4 hours + S3_INTEGRATION_BUCKET: ${{ vars.S3_INTEGRATION_BUCKET }} + KEY_NAME: ${{ secrets.KEY_NAME }} + CF_IAM_ROLE: ${{ secrets.CF_IAM_ROLE }} + CF_KEY_NAME: ${{ secrets.CF_KEY_NAME }} + ECR_INTEGRATION_TEST_REPO: "cwagent-integration-test" + CWA_GITHUB_TEST_REPO_NAME: "aws/amazon-cloudwatch-agent-test" + CWA_GITHUB_TEST_REPO_URL: "https://github.com/aws/amazon-cloudwatch-agent-test.git" + CWA_GITHUB_TEST_REPO_BRANCH: "main" + TERRAFORM_AWS_ASSUME_ROLE_ITAR: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + S3_INTEGRATION_BUCKET_ITAR: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + TERRAFORM_AWS_ASSUME_ROLE_CN: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + S3_INTEGRATION_BUCKET_CN: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + +on: + workflow_dispatch: + inputs: + build_id: + description: 'The build ID (release candidate build number or GitHub commit SHA)' + type: string + required: true + test_repo_branch: + description: 'Override for the test repo branch (default is main)' + type: string + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + OutputEnvVariables: + name: 'OutputEnvVariables' + runs-on: ubuntu-latest + outputs: + CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }} + CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }} + CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + steps: + - name: SetOutputs + id: set-outputs + run: | + CWA_GITHUB_TEST_REPO_BRANCH=${{ inputs.test_repo_branch }} + + echo "CWA_GITHUB_TEST_REPO_NAME=${{ env.CWA_GITHUB_TEST_REPO_NAME }}" >> "$GITHUB_OUTPUT" + echo "CWA_GITHUB_TEST_REPO_URL=${{ env.CWA_GITHUB_TEST_REPO_URL }}" >> "$GITHUB_OUTPUT" + echo "CWA_GITHUB_TEST_REPO_BRANCH=${CWA_GITHUB_TEST_REPO_BRANCH:-${{ env.CWA_GITHUB_TEST_REPO_BRANCH }}}" >> "$GITHUB_OUTPUT" + + - name: Echo test variables + run: | + echo "AGENT_S3_PATH_LINUX: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_LINUX }}" + echo "AGENT_S3_PATH_WINDOWS: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_WINDOWS }}" + echo "AGENT_S3_PATH_MAC: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_MAC }}" + echo "CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}" + echo "CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}" + echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" + + - uses: actions/checkout@v3 + with: + repository: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }} + ref: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + + - name: Set up Go 1.x + uses: actions/setup-go@v4 + with: + go-version: ~1.22.2 + + GenerateTestMatrix: + name: 'GenerateTestMatrix' + runs-on: ubuntu-latest + outputs: + ec2_gpu_matrix: ${{ steps.set-matrix.outputs.ec2_gpu_matrix }} + ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_matrix }} + ec2_windows_matrix: ${{ steps.set-matrix.outputs.ec2_windows_matrix }} + ec2_mac_matrix: ${{ steps.set-matrix.outputs.ec2_mac_matrix }} + ec2_performance_matrix: ${{steps.set-matrix.outputs.ec2_performance_matrix}} + ec2_windows_performance_matrix: ${{steps.set-matrix.outputs.ec2_windows_performance_matrix}} + ec2_stress_matrix: ${{steps.set-matrix.outputs.ec2_stress_matrix}} + ec2_windows_stress_matrix: ${{steps.set-matrix.outputs.ec2_windows_stress_matrix}} + ecs_ec2_launch_daemon_matrix: ${{ steps.set-matrix.outputs.ecs_ec2_launch_daemon_matrix }} + ecs_fargate_matrix: ${{ steps.set-matrix.outputs.ecs_fargate_matrix }} + eks_daemon_matrix: ${{ steps.set-matrix.outputs.eks_daemon_matrix }} + eks_deployment_matrix: ${{ steps.set-matrix.outputs.eks_deployment_matrix }} + 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: + - name: Generate matrix + id: set-matrix + run: | + go run --tags=generator generator/test_case_generator.go + echo "ec2_linux_matrix=$(echo $(cat generator/resources/ec2_linux_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_windows_matrix=$(echo $(cat generator/resources/ec2_windows_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_mac_matrix=$(echo $(cat generator/resources/ec2_mac_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + + - name: Echo test plan matrix + run: | + echo "ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_matrix }}" + echo "ec2_windows_matrix: ${{ steps.set-matrix.outputs.ec2_windows_matrix }}" + echo "ec2_mac_matrix: ${{ steps.set-matrix.outputs.ec2_mac_matrix }}" + + CloudformationTest: + needs: [OutputEnvVariables, GenerateTestMatrix] + name: 'CFTest' + runs-on: ubuntu-latest + strategy: + fail-fast: false + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + with: + repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + path: test + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ~1.22.2 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + - name: Test cf + run: | + cd test/test/cloudformation + go test -timeout 1h -package_path=s3://${{ vars.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_sha }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent + + StartLocalStack: + name: 'StartLocalStack' + needs: [OutputEnvVariables] + uses: ./.github/workflows/start-localstack.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + region: us-west-2 + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + github_sha: ${{github.sha}} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + + # StartLocalStackITAR: + # name: 'StartLocalStackITAR' + # needs: [OutputEnvVariables] + # uses: ./.github/workflows/start-localstack.yml + # secrets: inherit + # permissions: + # id-token: write + # contents: read + # with: + # region: us-gov-east-1 + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # github_sha: ${{github.sha}} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + + # StartLocalStackCN: + # name: 'StartLocalStackCN' + # needs: [ OutputEnvVariables ] + # uses: ./.github/workflows/start-localstack.yml + # secrets: inherit + # permissions: + # id-token: write + # contents: read + # with: + # region: cn-north-1 + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # github_sha: ${{github.sha}} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + + + + # EC2NvidiaGPUIntegrationTest: + # needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + # name: 'EC2NVIDIAGPUIntegrationTest' + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_gpu_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Echo Test Info + # run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # # nick-fields/retry@v2 starts at base dir + # - name: Terraform apply + # if: ${{ matrix.arrays.family == 'linux' }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 30 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/linux + # fi + + # terraform init + # if terraform apply --auto-approve \ + # -var="agent_s3_path_linux=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }}" \ + # -var="agent_s3_path_mac=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }}" \ + # -var="agent_s3_path_windows=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }}" \ + # -var="ssh_key_value=${PRIVATE_KEY}" -var="github_test_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ + # -var="test_name=${{ matrix.arrays.os }}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ + # -var="github_test_repo_branch=${{env.CWA_GITHUB_TEST_REPO_BRANCH}}" \ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="user=${{ matrix.arrays.username }}" \ + # -var="ami=${{ matrix.arrays.ami }}" \ + # -var="ca_cert_path=${{ matrix.arrays.caCertPath }}" \ + # -var="arc=${{ matrix.arrays.arc }}" \ + # -var="binary_name=${{ matrix.arrays.binaryName }}" \ + # -var="local_stack_host_name=${{ needs.StartLocalStack.outputs.local_stack_host_name }}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + # -var="ssh_key_name=${KEY_NAME}" \ + # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + # - name: Terraform apply + # if: ${{ matrix.arrays.family == 'window' }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 30 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/win + # fi + # terraform init + # if terraform apply --auto-approve \ + # -var="ssh_key_value=${PRIVATE_KEY}" -var="ssh_key_name=${KEY_NAME}" \ + # -var="github_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" -var="ami=${{ matrix.arrays.ami }}" \ + # -var="test_dir=${{ matrix.arrays.test_dir }}" \ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="github_test_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ + # -var="github_test_repo_branch=${{env.CWA_GITHUB_TEST_REPO_BRANCH}}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" ; then terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + # #This is here just in case workflow cancel + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # elif if "${{ matrix.arrays.os }}" == window; then + # cd terraform/ec2/win + # else + # cd terraform/ec2/linux + # fi + # terraform destroy --auto-approve + + EC2LinuxIntegrationTest: + needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + name: 'EC2Linux' + uses: ./.github/workflows/ec2-integration-test.yml + with: + build_id: ${{ inputs.build_id }} + test_dir: terraform/ec2/linux + job_id: ec2-linux-integration-test + test_props: ${{ needs.GenerateTestMatrix.outputs.ec2_linux_matrix }} + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + localstack_host: ${{ needs.StartLocalStack.outputs.local_stack_host_name }} + region: us-west-2 + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + secrets: inherit + + # EC2LinuxIntegrationTestITAR: + # needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] + # name: 'EC2LinuxITAR' + # uses: ./.github/workflows/ec2-integration-test.yml + # with: + # github_sha: ${{github.sha}} + # test_dir: terraform/ec2/linux + # job_id: ec2-linux-integration-test + # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_itar_matrix}} + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # localstack_host: ${{needs.StartLocalStackITAR.outputs.local_stack_host_name}} + # region: us-gov-east-1 + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + # secrets: inherit + + # EC2LinuxIntegrationTestCN: + # needs: [ StartLocalStackCN, GenerateTestMatrix, OutputEnvVariables ] + # name: 'EC2LinuxCN' + # uses: ./.github/workflows/ec2-integration-test.yml + # with: + # github_sha: ${{github.sha}} + # test_dir: terraform/ec2/linux + # job_id: ec2-linux-integration-test + # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_china_matrix}} + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # localstack_host: ${{needs.StartLocalStackCN.outputs.local_stack_host_name}} + # region: cn-north-1 + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + # secrets: inherit + + + # LinuxOnPremIntegrationTest: + # needs: [StartLocalStack, GenerateTestMatrix, OutputEnvVariables] + # name: 'OnpremLinux' + # uses: ./.github/workflows/ec2-integration-test.yml + # with: + # github_sha: ${{github.sha}} + # test_dir: terraform/ec2/linux_onprem + # job_id: linux-onprem-integration-test + # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_onprem_matrix}} + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} + # region: us-west-2 + # agent_s3_path_linux: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }} + # agent_s3_path_windows: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }} + # agent_s3_path_mac: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }} + # secrets: inherit + + # EC2WinIntegrationTest: + # needs: [OutputEnvVariables, GenerateTestMatrix] + # name: 'EC2WinIntegrationTest' + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Echo Test Info + # run: echo run on ec2 instance os ${{ matrix.arrays.os }} use ssm ${{ matrix.arrays.useSSM }} test ${{ matrix.arrays.test_dir }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # # nick-fields/retry@v2 starts at base dir + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 30 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/win + # fi + # terraform init + # if terraform apply --auto-approve \ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="ssh_key_value=${PRIVATE_KEY}" \ + # -var="ssh_key_name=${KEY_NAME}" \ + # -var="test_name=${{ matrix.arrays.os }}" \ + # -var="cwa_github_sha= ${{ inputs.build_id }}" \ + # -var="test_dir=${{ matrix.arrays.test_dir }}" \ + # -var="ami=${{ matrix.arrays.ami }}" \ + # -var="use_ssm=${{ matrix.arrays.useSSM }}" \ + # -var="s3_bucket=${{ vars.S3_INTEGRATION_BUCKET }}" \ + # terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # #This is here just in case workflow cancel + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/win + # fi + # terraform destroy --auto-approve + + # EC2DarwinIntegrationTest: + # needs: [GenerateTestMatrix, OutputEnvVariables] + # name: 'EC2DarwinIntegrationTest' + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_mac_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Echo OS + # run: echo run on ec2 instance os ${{ matrix.arrays.os }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # # nick-fields/retry@v2 starts at base dir + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 60 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/mac + # fi + # terraform init + # if terraform apply --auto-approve \ + # -var="ssh_key_value=${PRIVATE_KEY}" -var="ssh_key_name=${KEY_NAME}" \ + # -var="arc=${{ matrix.arrays.arc }}" \ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" -var="ami=${{ matrix.arrays.ami }}" \ + # -var="test_dir=${{ matrix.arrays.test_dir }}" \ + # -var="license_manager_arn=${{ env.LICENSE_MANAGER_ARN }}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + # -var="agent_s3_path_mac=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }}; then + # terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # #This is here just in case workflow cancel + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ec2/mac + # fi + # terraform destroy --auto-approve + + StopLocalStack: + name: 'StopLocalStack' + if: ${{ always() && needs.StartLocalStack.result == 'success' }} + needs: [ StartLocalStack, EC2LinuxIntegrationTest, LinuxOnPremIntegrationTest, OutputEnvVariables ] + uses: ./.github/workflows/stop-localstack.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + region: us-west-2 + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + github_sha: ${{github.sha}} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} + + # StopLocalStackITAR: + # name: 'StopLocalStackITAR' + # if: ${{ always() && needs.StartLocalStackITAR.result == 'success' }} + # needs: [ StartLocalStackITAR, EC2LinuxIntegrationTestITAR, OutputEnvVariables ] + # uses: ./.github/workflows/stop-localstack.yml + # secrets: inherit + # permissions: + # id-token: write + # contents: read + # with: + # region: us-gov-east-1 + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + # github_sha: ${{github.sha}} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + + # StopLocalStackCN: + # name: 'StopLocalStackCN' + # if: ${{ always() && needs.StartLocalStackCN.result == 'success' }} + # needs: [ StartLocalStackCN, EC2LinuxIntegrationTestCN ] + # uses: ./.github/workflows/stop-localstack.yml + # secrets: inherit + # permissions: + # id-token: write + # contents: read + # with: + # region: cn-north-1 + # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + # github_sha: ${{github.sha}} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + + # ECSEC2IntegrationTest: + # name: 'ECSEC2IntegrationTest' + # runs-on: ubuntu-latest + # needs: [ GenerateTestMatrix ] + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ecs_ec2_launch_daemon_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Login ECR + # id: login-ecr + # uses: aws-actions/amazon-ecr-login@v2 + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 15 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ecs_ec2/daemon + # fi + + # terraform init + # if terraform apply --auto-approve\ + # -var="test_dir=${{ matrix.arrays.test_dir }}"\ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ + # -var="cwagent_image_tag=${{ github.sha }}"\ + # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="metadataEnabled=${{ matrix.arrays.metadataEnabled }}" \ + # -var="ami=${{ matrix.arrays.ami }}" ; then + # terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ecs_ec2/daemon + # fi + # terraform destroy --auto-approve + + # ECSFargateIntegrationTest: + # name: 'ECSFargateIntegrationTest' + # runs-on: ubuntu-latest + # needs: [GenerateTestMatrix, OutputEnvVariables] + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ecs_fargate_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Login ECR + # id: login-ecr + # uses: aws-actions/amazon-ecr-login@v2 + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 15 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ecs_fargate/linux + # fi + + # terraform init + # if terraform apply --auto-approve\ + # -var="test_dir=${{ matrix.arrays.test_dir }}"\ + # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ + # -var="cwagent_image_tag=${{ github.sha }}"; then + # terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/ecs_fargate/linux + # fi + # terraform destroy --auto-approve + + # EKSIntegrationTest: + # name: 'EKSIntegrationTest' + # runs-on: ubuntu-latest + # needs: [ GenerateTestMatrix, OutputEnvVariables ] + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.eks_daemon_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Login ECR + # id: login-ecr + # uses: aws-actions/amazon-ecr-login@v2 + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 2 + # timeout_minutes: 90 # EKS takes about 20 minutes to spin up a cluster and service on the cluster + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/daemon + # fi + + # terraform init + # if terraform apply --auto-approve \ + # -var="test_dir=${{ matrix.arrays.test_dir }}"\ + # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \ + # -var="cwagent_image_tag=${{ github.sha }}" \ + # -var="ami_type=${{ matrix.arrays.ami }}" \ + # -var="instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="k8s_version=${{ matrix.arrays.k8sVersion }}"; then + # terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/daemon + # fi + # terraform destroy --auto-approve + + # EKSPrometheusIntegrationTest: + # name: 'EKSPrometheusIntegrationTest' + # runs-on: ubuntu-latest + # needs: [ GenerateTestMatrix, OutputEnvVariables ] + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.eks_deployment_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Login ECR + # id: login-ecr + # uses: aws-actions/amazon-ecr-login@v2 + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 60 # EKS takes about 20 minutes to spin up a cluster and service on the cluster + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/deployment + # fi + + # terraform init + # if terraform apply --auto-approve \ + # -var="test_dir=${{ matrix.arrays.test_dir }}"\ + # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \ + # -var="cwagent_image_tag=${{ github.sha }}" \ + # -var="k8s_version=${{ matrix.arrays.k8s_version }}"; then + # terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/deployment + # fi + # terraform destroy --auto-approve + + # PerformanceTrackingTest: + # name: "PerformanceTrackingTest" + # needs: [GenerateTestMatrix, OutputEnvVariables] + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_performance_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 1 + # timeout_minutes: 60 + # retry_wait_seconds: 5 + # command: | + # cd terraform/performance + # terraform init + # if terraform apply --auto-approve \ + # -var="agent_s3_path_linux=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }}" \ + # -var="agent_s3_path_mac=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }}" \ + # -var="agent_s3_path_windows=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }}" \ + # -var="ssh_key_value=${PRIVATE_KEY}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" \ + # -var="ami=${{ matrix.arrays.ami }}" \ + # -var="arc=${{ matrix.arrays.arc }}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + # -var="ssh_key_name=${KEY_NAME}" \ + # -var="values_per_minute=${{ matrix.arrays.values_per_minute}}"\ + # -var="family=${{ matrix.arrays.family}}"\ + # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: cd terraform/performance && terraform destroy --auto-approve + + # EC2WinPerformanceTest: + # name: "EC2WinPerformanceTest" + # needs: [ GenerateTestMatrix ] + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_performance_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 1 + # timeout_minutes: 60 + # retry_wait_seconds: 5 + # command: | + # cd terraform/performance + # terraform init + # if terraform apply --auto-approve \ + # -var="ssh_key_value=${PRIVATE_KEY}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" \ + # -var="ami=${{ matrix.arrays.ami }}" \ + # -var="arc=${{ matrix.arrays.arc }}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + # -var="ssh_key_name=${KEY_NAME}" \ + # -var="values_per_minute=${{ matrix.arrays.values_per_minute}}"\ + # -var="family=${{ matrix.arrays.family}}"\ + # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: cd terraform/performance && terraform destroy --auto-approve + + # StressTrackingTest: + # name: "StressTrackingTest" + # needs: [GenerateTestMatrix] + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_stress_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Echo Test Info + # run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }} values per minute ${{ matrix.arrays.values_per_minute }} + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 1 + # timeout_minutes: 60 + # retry_wait_seconds: 5 + # command: | + # cd terraform/stress + # terraform init + # if terraform apply --auto-approve \ + # -var="ssh_key_value=${PRIVATE_KEY}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" \ + # -var="ami=${{ matrix.arrays.ami }}" \ + # -var="arc=${{ matrix.arrays.arc }}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + # -var="ssh_key_name=${KEY_NAME}" \ + # -var="values_per_minute=${{ matrix.arrays.values_per_minute}}"\ + # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: cd terraform/stress && terraform destroy --auto-approve + + # EC2WinStressTrackingTest: + # name: "EC2WinStressTrackingTest" + # needs: [GenerateTestMatrix] + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_stress_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Echo Test Info + # run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }} values per minute ${{ matrix.arrays.values_per_minute }} + + # - name: Terraform apply + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 1 + # timeout_minutes: 60 + # retry_wait_seconds: 5 + # command: | + # cd terraform/stress + # terraform init + # if terraform apply --auto-approve \ + # -var="ssh_key_value=${PRIVATE_KEY}" \ + # -var="cwa_github_sha=${GITHUB_SHA}" \ + # -var="ami=${{ matrix.arrays.ami }}" \ + # -var="arc=${{ matrix.arrays.arc }}" \ + # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + # -var="ssh_key_name=${KEY_NAME}" \ + # -var="values_per_minute=${{ matrix.arrays.values_per_minute}}"\ + # -var="family=${{ matrix.arrays.family}}"\ + # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Terraform destroy + # if: ${{ cancelled() || failure() }} + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: cd terraform/stress && terraform destroy --auto-approve + + # GPUEndToEndTest: + # name: "GPU E2E Test" + # needs: [ GenerateTestMatrix, OutputEnvVariables ] + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.eks_addon_matrix) }} + # permissions: + # id-token: write + # contents: read + # steps: + # - uses: actions/checkout@v3 + # with: + # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + + # - name: Configure AWS Credentials + # uses: aws-actions/configure-aws-credentials@v2 + # with: + # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + # aws-region: us-west-2 + # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + + # - name: Verify Terraform version + # run: terraform --version + + # - name: Terraform apply and setup + # run: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/addon/gpu + # fi + + # terraform init + # if terraform apply --auto-approve \ + # -var="beta=true" \ + # -var="ami_type=${{ matrix.arrays.ami }}" \ + # -var="instance_type=${{ matrix.arrays.instanceType }}" \ + # -var="k8s_version=${{ matrix.arrays.k8sVersion }}"; then + # echo "Terraform apply successful." + + # # Capture the output + # echo "Getting EKS cluster name" + # EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) + # echo "Cluster name is ${EKS_CLUSTER_NAME}" + # kubectl create -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.17.0/deployments/static/nvidia-device-plugin.yml + # kubectl patch amazoncloudwatchagents -n amazon-cloudwatch cloudwatch-agent --type='json' -p='[{"op": "replace", "path": "/spec/image", "value": ${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/${{ env.ECR_INTEGRATION_TEST_REPO }}:${{ github.sha }}}]' + # # wait nvidia device plugin to be ready + # sleep 10 + # kubectl apply -f ./gpuBurner.yaml + # else + # terraform destroy -auto-approve && exit 1 + # fi + + # - name: Run Go tests with retry + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 5 + # timeout_minutes: 60 + # retry_wait_seconds: 30 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/addon/gpu + # fi + # echo "Getting EKS cluster name" + # EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) + # echo "Cluster name is ${EKS_CLUSTER_NAME}" + + # if go test ${{ matrix.arrays.test_dir }} -eksClusterName ${EKS_CLUSTER_NAME} -computeType=EKS -v -eksDeploymentStrategy=DAEMON -eksGpuType=nvidia -useE2EMetrics; then + # echo "Tests passed" + # else + # echo "Tests failed" + # exit 1 + # fi + + # - name: Terraform destroy + # if: always() + # uses: nick-fields/retry@v2 + # with: + # max_attempts: 3 + # timeout_minutes: 8 + # retry_wait_seconds: 5 + # command: | + # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + # cd "${{ matrix.arrays.terraform_dir }}" + # else + # cd terraform/eks/addon/gpu + # fi + # terraform destroy -auto-approve From 60b6000db99cf88311dba670d62222b51d6b8df4 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Fri, 7 Feb 2025 09:24:32 -0500 Subject: [PATCH 13/39] temporarily remove onprem from stoplocalstack --- .github/workflows/release-candidate-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml index 40d9bc139b..73ee9e0d64 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/release-candidate-test.yml @@ -538,7 +538,8 @@ jobs: StopLocalStack: name: 'StopLocalStack' if: ${{ always() && needs.StartLocalStack.result == 'success' }} - needs: [ StartLocalStack, EC2LinuxIntegrationTest, LinuxOnPremIntegrationTest, OutputEnvVariables ] + #needs: [ StartLocalStack, EC2LinuxIntegrationTest, LinuxOnPremIntegrationTest, OutputEnvVariables ] + needs: [ StartLocalStack, EC2LinuxIntegrationTest, OutputEnvVariables ] uses: ./.github/workflows/stop-localstack.yml secrets: inherit permissions: From a42385cdb943a52b18a126d7c874e5d56d19a96a Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Fri, 7 Feb 2025 09:32:20 -0500 Subject: [PATCH 14/39] Remove most of the workflow. Download release artifacts --- .github/workflows/release-candidate-test.yml | 1169 +----------------- 1 file changed, 7 insertions(+), 1162 deletions(-) diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml index 73ee9e0d64..6ec1f5897e 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/release-candidate-test.yml @@ -55,9 +55,6 @@ jobs: - name: Echo test variables run: | - echo "AGENT_S3_PATH_LINUX: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_LINUX }}" - echo "AGENT_S3_PATH_WINDOWS: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_WINDOWS }}" - echo "AGENT_S3_PATH_MAC: ${{ steps.set-outputs.outputs.AGENT_S3_PATH_MAC }}" echo "CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}" echo "CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}" echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" @@ -72,1165 +69,13 @@ jobs: with: go-version: ~1.22.2 - GenerateTestMatrix: - name: 'GenerateTestMatrix' + RepackageReleaseCandidate: + name: 'RepackageReleaseCandidate' runs-on: ubuntu-latest - outputs: - ec2_gpu_matrix: ${{ steps.set-matrix.outputs.ec2_gpu_matrix }} - ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_matrix }} - ec2_windows_matrix: ${{ steps.set-matrix.outputs.ec2_windows_matrix }} - ec2_mac_matrix: ${{ steps.set-matrix.outputs.ec2_mac_matrix }} - ec2_performance_matrix: ${{steps.set-matrix.outputs.ec2_performance_matrix}} - ec2_windows_performance_matrix: ${{steps.set-matrix.outputs.ec2_windows_performance_matrix}} - ec2_stress_matrix: ${{steps.set-matrix.outputs.ec2_stress_matrix}} - ec2_windows_stress_matrix: ${{steps.set-matrix.outputs.ec2_windows_stress_matrix}} - ecs_ec2_launch_daemon_matrix: ${{ steps.set-matrix.outputs.ecs_ec2_launch_daemon_matrix }} - ecs_fargate_matrix: ${{ steps.set-matrix.outputs.ecs_fargate_matrix }} - eks_daemon_matrix: ${{ steps.set-matrix.outputs.eks_daemon_matrix }} - eks_deployment_matrix: ${{ steps.set-matrix.outputs.eks_deployment_matrix }} - 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: - - name: Generate matrix - id: set-matrix - run: | - go run --tags=generator generator/test_case_generator.go - echo "ec2_linux_matrix=$(echo $(cat generator/resources/ec2_linux_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - echo "ec2_windows_matrix=$(echo $(cat generator/resources/ec2_windows_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - echo "ec2_mac_matrix=$(echo $(cat generator/resources/ec2_mac_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - - - name: Echo test plan matrix - run: | - echo "ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_matrix }}" - echo "ec2_windows_matrix: ${{ steps.set-matrix.outputs.ec2_windows_matrix }}" - echo "ec2_mac_matrix: ${{ steps.set-matrix.outputs.ec2_mac_matrix }}" - - CloudformationTest: - needs: [OutputEnvVariables, GenerateTestMatrix] - name: 'CFTest' - runs-on: ubuntu-latest - strategy: - fail-fast: false - permissions: - id-token: write - contents: read steps: - - uses: actions/checkout@v3 - with: - repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - path: test - - - name: Set up Go 1.x - uses: actions/setup-go@v2 - with: - go-version: ~1.22.2 - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - aws-region: us-west-2 - role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - - name: Test cf + - name: Download Artifacts + id: download-artifacts run: | - cd test/test/cloudformation - go test -timeout 1h -package_path=s3://${{ vars.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_sha }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent - - StartLocalStack: - name: 'StartLocalStack' - needs: [OutputEnvVariables] - uses: ./.github/workflows/start-localstack.yml - secrets: inherit - permissions: - id-token: write - contents: read - with: - region: us-west-2 - test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} - test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - github_sha: ${{github.sha}} - s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} - - # StartLocalStackITAR: - # name: 'StartLocalStackITAR' - # needs: [OutputEnvVariables] - # uses: ./.github/workflows/start-localstack.yml - # secrets: inherit - # permissions: - # id-token: write - # contents: read - # with: - # region: us-gov-east-1 - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # github_sha: ${{github.sha}} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} - - # StartLocalStackCN: - # name: 'StartLocalStackCN' - # needs: [ OutputEnvVariables ] - # uses: ./.github/workflows/start-localstack.yml - # secrets: inherit - # permissions: - # id-token: write - # contents: read - # with: - # region: cn-north-1 - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # github_sha: ${{github.sha}} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} - - - - # EC2NvidiaGPUIntegrationTest: - # needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] - # name: 'EC2NVIDIAGPUIntegrationTest' - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_gpu_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - # - name: Echo Test Info - # run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }} - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - - # - name: Verify Terraform version - # run: terraform --version - - # # nick-fields/retry@v2 starts at base dir - # - name: Terraform apply - # if: ${{ matrix.arrays.family == 'linux' }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 30 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ec2/linux - # fi - - # terraform init - # if terraform apply --auto-approve \ - # -var="agent_s3_path_linux=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }}" \ - # -var="agent_s3_path_mac=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }}" \ - # -var="agent_s3_path_windows=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }}" \ - # -var="ssh_key_value=${PRIVATE_KEY}" -var="github_test_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ - # -var="test_name=${{ matrix.arrays.os }}" \ - # -var="cwa_github_sha=${GITHUB_SHA}" -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ - # -var="github_test_repo_branch=${{env.CWA_GITHUB_TEST_REPO_BRANCH}}" \ - # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="user=${{ matrix.arrays.username }}" \ - # -var="ami=${{ matrix.arrays.ami }}" \ - # -var="ca_cert_path=${{ matrix.arrays.caCertPath }}" \ - # -var="arc=${{ matrix.arrays.arc }}" \ - # -var="binary_name=${{ matrix.arrays.binaryName }}" \ - # -var="local_stack_host_name=${{ needs.StartLocalStack.outputs.local_stack_host_name }}" \ - # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ - # -var="ssh_key_name=${KEY_NAME}" \ - # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi - # - name: Terraform apply - # if: ${{ matrix.arrays.family == 'window' }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 30 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ec2/win - # fi - # terraform init - # if terraform apply --auto-approve \ - # -var="ssh_key_value=${PRIVATE_KEY}" -var="ssh_key_name=${KEY_NAME}" \ - # -var="github_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ - # -var="cwa_github_sha=${GITHUB_SHA}" -var="ami=${{ matrix.arrays.ami }}" \ - # -var="test_dir=${{ matrix.arrays.test_dir }}" \ - # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="github_test_repo=${{env.CWA_GITHUB_TEST_REPO_URL}}" \ - # -var="github_test_repo_branch=${{env.CWA_GITHUB_TEST_REPO_BRANCH}}" \ - # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" ; then terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi - # #This is here just in case workflow cancel - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # elif if "${{ matrix.arrays.os }}" == window; then - # cd terraform/ec2/win - # else - # cd terraform/ec2/linux - # fi - # terraform destroy --auto-approve - - EC2LinuxIntegrationTest: - needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] - name: 'EC2Linux' - uses: ./.github/workflows/ec2-integration-test.yml - with: - build_id: ${{ inputs.build_id }} - test_dir: terraform/ec2/linux - job_id: ec2-linux-integration-test - test_props: ${{ needs.GenerateTestMatrix.outputs.ec2_linux_matrix }} - test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - localstack_host: ${{ needs.StartLocalStack.outputs.local_stack_host_name }} - region: us-west-2 - terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} - s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} - secrets: inherit - - # EC2LinuxIntegrationTestITAR: - # needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] - # name: 'EC2LinuxITAR' - # uses: ./.github/workflows/ec2-integration-test.yml - # with: - # github_sha: ${{github.sha}} - # test_dir: terraform/ec2/linux - # job_id: ec2-linux-integration-test - # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_itar_matrix}} - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # localstack_host: ${{needs.StartLocalStackITAR.outputs.local_stack_host_name}} - # region: us-gov-east-1 - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} - # secrets: inherit - - # EC2LinuxIntegrationTestCN: - # needs: [ StartLocalStackCN, GenerateTestMatrix, OutputEnvVariables ] - # name: 'EC2LinuxCN' - # uses: ./.github/workflows/ec2-integration-test.yml - # with: - # github_sha: ${{github.sha}} - # test_dir: terraform/ec2/linux - # job_id: ec2-linux-integration-test - # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_china_matrix}} - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # localstack_host: ${{needs.StartLocalStackCN.outputs.local_stack_host_name}} - # region: cn-north-1 - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} - # secrets: inherit - - - # LinuxOnPremIntegrationTest: - # needs: [StartLocalStack, GenerateTestMatrix, OutputEnvVariables] - # name: 'OnpremLinux' - # uses: ./.github/workflows/ec2-integration-test.yml - # with: - # github_sha: ${{github.sha}} - # test_dir: terraform/ec2/linux_onprem - # job_id: linux-onprem-integration-test - # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_onprem_matrix}} - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} - # region: us-west-2 - # agent_s3_path_linux: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }} - # agent_s3_path_windows: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }} - # agent_s3_path_mac: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }} - # secrets: inherit - - # EC2WinIntegrationTest: - # needs: [OutputEnvVariables, GenerateTestMatrix] - # name: 'EC2WinIntegrationTest' - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - # - name: Echo Test Info - # run: echo run on ec2 instance os ${{ matrix.arrays.os }} use ssm ${{ matrix.arrays.useSSM }} test ${{ matrix.arrays.test_dir }} - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - - # - name: Verify Terraform version - # run: terraform --version - - # # nick-fields/retry@v2 starts at base dir - # - name: Terraform apply - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 30 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ec2/win - # fi - # terraform init - # if terraform apply --auto-approve \ - # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="ssh_key_value=${PRIVATE_KEY}" \ - # -var="ssh_key_name=${KEY_NAME}" \ - # -var="test_name=${{ matrix.arrays.os }}" \ - # -var="cwa_github_sha= ${{ inputs.build_id }}" \ - # -var="test_dir=${{ matrix.arrays.test_dir }}" \ - # -var="ami=${{ matrix.arrays.ami }}" \ - # -var="use_ssm=${{ matrix.arrays.useSSM }}" \ - # -var="s3_bucket=${{ vars.S3_INTEGRATION_BUCKET }}" \ - # terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi - - # #This is here just in case workflow cancel - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ec2/win - # fi - # terraform destroy --auto-approve - - # EC2DarwinIntegrationTest: - # needs: [GenerateTestMatrix, OutputEnvVariables] - # name: 'EC2DarwinIntegrationTest' - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_mac_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - # - name: Echo OS - # run: echo run on ec2 instance os ${{ matrix.arrays.os }} - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - - # - name: Verify Terraform version - # run: terraform --version - - # # nick-fields/retry@v2 starts at base dir - # - name: Terraform apply - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 60 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ec2/mac - # fi - # terraform init - # if terraform apply --auto-approve \ - # -var="ssh_key_value=${PRIVATE_KEY}" -var="ssh_key_name=${KEY_NAME}" \ - # -var="arc=${{ matrix.arrays.arc }}" \ - # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="cwa_github_sha=${GITHUB_SHA}" -var="ami=${{ matrix.arrays.ami }}" \ - # -var="test_dir=${{ matrix.arrays.test_dir }}" \ - # -var="license_manager_arn=${{ env.LICENSE_MANAGER_ARN }}" \ - # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ - # -var="agent_s3_path_mac=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }}; then - # terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi - - # #This is here just in case workflow cancel - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ec2/mac - # fi - # terraform destroy --auto-approve - - StopLocalStack: - name: 'StopLocalStack' - if: ${{ always() && needs.StartLocalStack.result == 'success' }} - #needs: [ StartLocalStack, EC2LinuxIntegrationTest, LinuxOnPremIntegrationTest, OutputEnvVariables ] - needs: [ StartLocalStack, EC2LinuxIntegrationTest, OutputEnvVariables ] - uses: ./.github/workflows/stop-localstack.yml - secrets: inherit - permissions: - id-token: write - contents: read - with: - region: us-west-2 - test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} - github_sha: ${{github.sha}} - s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} - - # StopLocalStackITAR: - # name: 'StopLocalStackITAR' - # if: ${{ always() && needs.StartLocalStackITAR.result == 'success' }} - # needs: [ StartLocalStackITAR, EC2LinuxIntegrationTestITAR, OutputEnvVariables ] - # uses: ./.github/workflows/stop-localstack.yml - # secrets: inherit - # permissions: - # id-token: write - # contents: read - # with: - # region: us-gov-east-1 - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} - # github_sha: ${{github.sha}} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} - - # StopLocalStackCN: - # name: 'StopLocalStackCN' - # if: ${{ always() && needs.StartLocalStackCN.result == 'success' }} - # needs: [ StartLocalStackCN, EC2LinuxIntegrationTestCN ] - # uses: ./.github/workflows/stop-localstack.yml - # secrets: inherit - # permissions: - # id-token: write - # contents: read - # with: - # region: cn-north-1 - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} - # github_sha: ${{github.sha}} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} - - # ECSEC2IntegrationTest: - # name: 'ECSEC2IntegrationTest' - # runs-on: ubuntu-latest - # needs: [ GenerateTestMatrix ] - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ecs_ec2_launch_daemon_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - # - name: Login ECR - # id: login-ecr - # uses: aws-actions/amazon-ecr-login@v2 - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - - # - name: Verify Terraform version - # run: terraform --version - - # - name: Terraform apply - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 15 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ecs_ec2/daemon - # fi - - # terraform init - # if terraform apply --auto-approve\ - # -var="test_dir=${{ matrix.arrays.test_dir }}"\ - # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ - # -var="cwagent_image_tag=${{ github.sha }}"\ - # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="metadataEnabled=${{ matrix.arrays.metadataEnabled }}" \ - # -var="ami=${{ matrix.arrays.ami }}" ; then - # terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi - - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ecs_ec2/daemon - # fi - # terraform destroy --auto-approve - - # ECSFargateIntegrationTest: - # name: 'ECSFargateIntegrationTest' - # runs-on: ubuntu-latest - # needs: [GenerateTestMatrix, OutputEnvVariables] - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ecs_fargate_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - # - name: Login ECR - # id: login-ecr - # uses: aws-actions/amazon-ecr-login@v2 - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - - # - name: Verify Terraform version - # run: terraform --version - - # - name: Terraform apply - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 15 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ecs_fargate/linux - # fi - - # terraform init - # if terraform apply --auto-approve\ - # -var="test_dir=${{ matrix.arrays.test_dir }}"\ - # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ - # -var="cwagent_image_tag=${{ github.sha }}"; then - # terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ecs_fargate/linux - # fi - # terraform destroy --auto-approve - - # EKSIntegrationTest: - # name: 'EKSIntegrationTest' - # runs-on: ubuntu-latest - # needs: [ GenerateTestMatrix, OutputEnvVariables ] - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.eks_daemon_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - # - name: Login ECR - # id: login-ecr - # uses: aws-actions/amazon-ecr-login@v2 - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - - # - name: Verify Terraform version - # run: terraform --version - - # - name: Terraform apply - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 2 - # timeout_minutes: 90 # EKS takes about 20 minutes to spin up a cluster and service on the cluster - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/eks/daemon - # fi - - # terraform init - # if terraform apply --auto-approve \ - # -var="test_dir=${{ matrix.arrays.test_dir }}"\ - # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \ - # -var="cwagent_image_tag=${{ github.sha }}" \ - # -var="ami_type=${{ matrix.arrays.ami }}" \ - # -var="instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="k8s_version=${{ matrix.arrays.k8sVersion }}"; then - # terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi - - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/eks/daemon - # fi - # terraform destroy --auto-approve - - # EKSPrometheusIntegrationTest: - # name: 'EKSPrometheusIntegrationTest' - # runs-on: ubuntu-latest - # needs: [ GenerateTestMatrix, OutputEnvVariables ] - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.eks_deployment_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - # - name: Login ECR - # id: login-ecr - # uses: aws-actions/amazon-ecr-login@v2 - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - - # - name: Verify Terraform version - # run: terraform --version - - # - name: Terraform apply - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 60 # EKS takes about 20 minutes to spin up a cluster and service on the cluster - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/eks/deployment - # fi - - # terraform init - # if terraform apply --auto-approve \ - # -var="test_dir=${{ matrix.arrays.test_dir }}"\ - # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \ - # -var="cwagent_image_tag=${{ github.sha }}" \ - # -var="k8s_version=${{ matrix.arrays.k8s_version }}"; then - # terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi - - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/eks/deployment - # fi - # terraform destroy --auto-approve - - # PerformanceTrackingTest: - # name: "PerformanceTrackingTest" - # needs: [GenerateTestMatrix, OutputEnvVariables] - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_performance_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - - # - name: Verify Terraform version - # run: terraform --version - - # - name: Terraform apply - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 1 - # timeout_minutes: 60 - # retry_wait_seconds: 5 - # command: | - # cd terraform/performance - # terraform init - # if terraform apply --auto-approve \ - # -var="agent_s3_path_linux=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }}" \ - # -var="agent_s3_path_mac=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }}" \ - # -var="agent_s3_path_windows=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }}" \ - # -var="ssh_key_value=${PRIVATE_KEY}" \ - # -var="cwa_github_sha=${GITHUB_SHA}" \ - # -var="ami=${{ matrix.arrays.ami }}" \ - # -var="arc=${{ matrix.arrays.arc }}" \ - # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ - # -var="ssh_key_name=${KEY_NAME}" \ - # -var="values_per_minute=${{ matrix.arrays.values_per_minute}}"\ - # -var="family=${{ matrix.arrays.family}}"\ - # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi - - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: cd terraform/performance && terraform destroy --auto-approve - - # EC2WinPerformanceTest: - # name: "EC2WinPerformanceTest" - # needs: [ GenerateTestMatrix ] - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_performance_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - - # - name: Verify Terraform version - # run: terraform --version - - # - name: Terraform apply - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 1 - # timeout_minutes: 60 - # retry_wait_seconds: 5 - # command: | - # cd terraform/performance - # terraform init - # if terraform apply --auto-approve \ - # -var="ssh_key_value=${PRIVATE_KEY}" \ - # -var="cwa_github_sha=${GITHUB_SHA}" \ - # -var="ami=${{ matrix.arrays.ami }}" \ - # -var="arc=${{ matrix.arrays.arc }}" \ - # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ - # -var="ssh_key_name=${KEY_NAME}" \ - # -var="values_per_minute=${{ matrix.arrays.values_per_minute}}"\ - # -var="family=${{ matrix.arrays.family}}"\ - # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi - - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: cd terraform/performance && terraform destroy --auto-approve - - # StressTrackingTest: - # name: "StressTrackingTest" - # needs: [GenerateTestMatrix] - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_stress_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - - # - name: Verify Terraform version - # run: terraform --version - - # - name: Echo Test Info - # run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }} values per minute ${{ matrix.arrays.values_per_minute }} - - # - name: Terraform apply - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 1 - # timeout_minutes: 60 - # retry_wait_seconds: 5 - # command: | - # cd terraform/stress - # terraform init - # if terraform apply --auto-approve \ - # -var="ssh_key_value=${PRIVATE_KEY}" \ - # -var="cwa_github_sha=${GITHUB_SHA}" \ - # -var="ami=${{ matrix.arrays.ami }}" \ - # -var="arc=${{ matrix.arrays.arc }}" \ - # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ - # -var="ssh_key_name=${KEY_NAME}" \ - # -var="values_per_minute=${{ matrix.arrays.values_per_minute}}"\ - # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi - - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: cd terraform/stress && terraform destroy --auto-approve - - # EC2WinStressTrackingTest: - # name: "EC2WinStressTrackingTest" - # needs: [GenerateTestMatrix] - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_stress_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - - # - name: Verify Terraform version - # run: terraform --version - - # - name: Echo Test Info - # run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }} values per minute ${{ matrix.arrays.values_per_minute }} - - # - name: Terraform apply - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 1 - # timeout_minutes: 60 - # retry_wait_seconds: 5 - # command: | - # cd terraform/stress - # terraform init - # if terraform apply --auto-approve \ - # -var="ssh_key_value=${PRIVATE_KEY}" \ - # -var="cwa_github_sha=${GITHUB_SHA}" \ - # -var="ami=${{ matrix.arrays.ami }}" \ - # -var="arc=${{ matrix.arrays.arc }}" \ - # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ - # -var="ssh_key_name=${KEY_NAME}" \ - # -var="values_per_minute=${{ matrix.arrays.values_per_minute}}"\ - # -var="family=${{ matrix.arrays.family}}"\ - # -var="test_dir=${{ matrix.arrays.test_dir }}" ; then terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi - - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: cd terraform/stress && terraform destroy --auto-approve - - # GPUEndToEndTest: - # name: "GPU E2E Test" - # needs: [ GenerateTestMatrix, OutputEnvVariables ] - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.eks_addon_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - # ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - - # - name: Verify Terraform version - # run: terraform --version - - # - name: Terraform apply and setup - # run: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/eks/addon/gpu - # fi - - # terraform init - # if terraform apply --auto-approve \ - # -var="beta=true" \ - # -var="ami_type=${{ matrix.arrays.ami }}" \ - # -var="instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="k8s_version=${{ matrix.arrays.k8sVersion }}"; then - # echo "Terraform apply successful." - - # # Capture the output - # echo "Getting EKS cluster name" - # EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) - # echo "Cluster name is ${EKS_CLUSTER_NAME}" - # kubectl create -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.17.0/deployments/static/nvidia-device-plugin.yml - # kubectl patch amazoncloudwatchagents -n amazon-cloudwatch cloudwatch-agent --type='json' -p='[{"op": "replace", "path": "/spec/image", "value": ${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/${{ env.ECR_INTEGRATION_TEST_REPO }}:${{ github.sha }}}]' - # # wait nvidia device plugin to be ready - # sleep 10 - # kubectl apply -f ./gpuBurner.yaml - # else - # terraform destroy -auto-approve && exit 1 - # fi - - # - name: Run Go tests with retry - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 5 - # timeout_minutes: 60 - # retry_wait_seconds: 30 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/eks/addon/gpu - # fi - # echo "Getting EKS cluster name" - # EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) - # echo "Cluster name is ${EKS_CLUSTER_NAME}" - - # if go test ${{ matrix.arrays.test_dir }} -eksClusterName ${EKS_CLUSTER_NAME} -computeType=EKS -v -eksDeploymentStrategy=DAEMON -eksGpuType=nvidia -useE2EMetrics; then - # echo "Tests passed" - # else - # echo "Tests failed" - # exit 1 - # fi - - # - name: Terraform destroy - # if: always() - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/eks/addon/gpu - # fi - # terraform destroy -auto-approve + aws s3 cp --no-progress s3://amazon-cloud-watch-agent/windows/amd64/${{ inputs.build_id }} . + aws s3 cp --no-progress s3://amazon-cloud-watch-agent/linux/amd64/${{ inputs.build_id }} . + aws s3 cp --no-progress s3://amazon-cloud-watch-agent/darwin/amd64/${{ inputs.build_id }} . \ No newline at end of file From a478176e336f15ca8cc406ee11a70b779eea8235 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Fri, 7 Feb 2025 09:33:21 -0500 Subject: [PATCH 15/39] Add credentials --- .github/workflows/release-candidate-test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml index 6ec1f5897e..3e86073757 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/release-candidate-test.yml @@ -73,6 +73,13 @@ jobs: name: 'RepackageReleaseCandidate' runs-on: ubuntu-latest steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + - name: Download Artifacts id: download-artifacts run: | From ec6616765d002b2dc86dfab25f7ceaa80601d300 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Fri, 7 Feb 2025 09:35:54 -0500 Subject: [PATCH 16/39] Add checkout --- .github/workflows/release-candidate-test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml index 3e86073757..f92055dab3 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/release-candidate-test.yml @@ -73,6 +73,12 @@ jobs: name: 'RepackageReleaseCandidate' runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 + with: + repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} + ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} + path: test + - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v2 with: From 0f3663956c76559754d2cbd5fe2cf6bcb39912c3 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Fri, 7 Feb 2025 09:37:33 -0500 Subject: [PATCH 17/39] Add permissions --- .github/workflows/release-candidate-test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml index f92055dab3..e58d4fdc77 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/release-candidate-test.yml @@ -72,6 +72,11 @@ jobs: RepackageReleaseCandidate: name: 'RepackageReleaseCandidate' runs-on: ubuntu-latest + strategy: + fail-fast: false + permissions: + id-token: write + contents: read steps: - uses: actions/checkout@v3 with: From f6a371c5d40e92b76300402c532e29a3d431897e Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Fri, 7 Feb 2025 09:48:31 -0500 Subject: [PATCH 18/39] download zipfile --- .github/workflows/release-candidate-test.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml index e58d4fdc77..bfefeb73a3 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/release-candidate-test.yml @@ -94,6 +94,14 @@ jobs: - name: Download Artifacts id: download-artifacts run: | - aws s3 cp --no-progress s3://amazon-cloud-watch-agent/windows/amd64/${{ inputs.build_id }} . - aws s3 cp --no-progress s3://amazon-cloud-watch-agent/linux/amd64/${{ inputs.build_id }} . - aws s3 cp --no-progress s3://amazon-cloud-watch-agent/darwin/amd64/${{ inputs.build_id }} . \ No newline at end of file + mkdir -p windows/amd64/ + aws s3 cp --no-progress s3://amazon-cloud-watch-agent/windows/amd64/${{ inputs.build_id }}/AmazonCloudWatchAgent.zip ./windows/amd64/ + + mkdir -p linux/amd64 + aws s3 cp --no-progress s3://amazon-cloud-watch-agent/linux/amd64/${{ inputs.build_id }}/AmazonCloudWatchAgent.zip ./linux/amd64 + + mkdir -p linux/arm64 + aws s3 cp --no-progress s3://amazon-cloud-watch-agent/linux/arm64/${{ inputs.build_id }}/AmazonCloudWatchAgent.zip ./linux/arm64 + + mkdir -p darwin/amd64 + aws s3 cp --no-progress s3://amazon-cloud-watch-agent/darwin/amd64/${{ inputs.build_id }}/AmazonCloudWatchAgent.zip ./darwin/amd64 \ No newline at end of file From 5a7b560ef4370aacfc1ef4bca274fcc521e50dc5 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Fri, 7 Feb 2025 10:08:28 -0500 Subject: [PATCH 19/39] Download and re-upload artifacts --- .github/workflows/release-candidate-test.yml | 42 ++++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml index bfefeb73a3..6704a00a9f 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/release-candidate-test.yml @@ -7,6 +7,7 @@ env: TERRAFORM_AWS_ASSUME_ROLE: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} TERRAFORM_AWS_ASSUME_ROLE_DURATION: 14400 # 4 hours S3_INTEGRATION_BUCKET: ${{ vars.S3_INTEGRATION_BUCKET }} + S3_RELEASE_BUCKET: amazon-cloud-watch-agent KEY_NAME: ${{ secrets.KEY_NAME }} CF_IAM_ROLE: ${{ secrets.CF_IAM_ROLE }} CF_KEY_NAME: ${{ secrets.CF_KEY_NAME }} @@ -95,13 +96,46 @@ jobs: id: download-artifacts run: | mkdir -p windows/amd64/ - aws s3 cp --no-progress s3://amazon-cloud-watch-agent/windows/amd64/${{ inputs.build_id }}/AmazonCloudWatchAgent.zip ./windows/amd64/ + aws s3 cp --no-progress s3://${{ env.S3_RELEASE_BUCKET }}/windows/amd64/${{ inputs.build_id }}/AmazonCloudWatchAgent.zip ./windows/amd64/ mkdir -p linux/amd64 - aws s3 cp --no-progress s3://amazon-cloud-watch-agent/linux/amd64/${{ inputs.build_id }}/AmazonCloudWatchAgent.zip ./linux/amd64 + aws s3 cp --no-progress s3://${{ env.S3_RELEASE_BUCKET }}/linux/amd64/${{ inputs.build_id }}/AmazonCloudWatchAgent.zip ./linux/amd64 mkdir -p linux/arm64 - aws s3 cp --no-progress s3://amazon-cloud-watch-agent/linux/arm64/${{ inputs.build_id }}/AmazonCloudWatchAgent.zip ./linux/arm64 + aws s3 cp --no-progress s3://${{ env.S3_RELEASE_BUCKET }}/linux/arm64/${{ inputs.build_id }}/AmazonCloudWatchAgent.zip ./linux/arm64 mkdir -p darwin/amd64 - aws s3 cp --no-progress s3://amazon-cloud-watch-agent/darwin/amd64/${{ inputs.build_id }}/AmazonCloudWatchAgent.zip ./darwin/amd64 \ No newline at end of file + aws s3 cp --no-progress s3://${{ env.S3_RELEASE_BUCKET }}/darwin/amd64/${{ inputs.build_id }}/AmazonCloudWatchAgent.zip ./darwin/amd64 + + mkdir -p darwin/arm64 + aws s3 cp --no-progress s3://${{ env.S3_RELEASE_BUCKET }}/darwin/arm64/${{ inputs.build_id }}/AmazonCloudWatchAgent.zip ./darwin/arm64 + + - name: Re-upload Artifacts + id: uncompress-artifacts + run: | + pushd windows/amd64/ + unzip AmazonCloudWatchAgent.zip + aws s3 cp ./amazon-cloudwatch-agent.msi s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/packaging/${{ inputs.build_id }}/amazon-cloudwatch-agent.msi + popd + + pushd linux/amd64 + unzip AmazonCloudWatchAgent.zip + aws s3 cp ./amazon-cloudwatch-agent.rpm s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.rpm + aws s3 cp ./amazon-cloudwatch-agent.deb s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.deb + popd + + pushd linux/arm64 + unzip AmazonCloudWatchAgent.zip + aws s3 cp ./amazon-cloudwatch-agent.rpm s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/arm64/amazon-cloudwatch-agent.rpm + aws s3 cp ./amazon-cloudwatch-agent.deb s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.deb + popd + + pushd darwin/amd64 + unzip AmazonCloudWatchAgent.zip + aws s3 cp ./amazon-cloudwatch-agent.pkg s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/packaging/${{ inputs.build_id }}/arm64/amazon-cloudwatch-agent.pkg + popd + + pushd darwin/arm64 + unzip AmazonCloudWatchAgent.zip + aws s3 cp ./amazon-cloudwatch-agent.pkg s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/packaging/${{ inputs.build_id }}/arm64/amazon-cloudwatch-agent.pkg + popd From 57f9e894cba69369445b6ac5790d4ab667530956 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Fri, 7 Feb 2025 10:10:12 -0500 Subject: [PATCH 20/39] show no progress on aws s3 cp --- .github/workflows/release-candidate-test.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml index 6704a00a9f..9ee786aa17 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/release-candidate-test.yml @@ -115,27 +115,27 @@ jobs: run: | pushd windows/amd64/ unzip AmazonCloudWatchAgent.zip - aws s3 cp ./amazon-cloudwatch-agent.msi s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/packaging/${{ inputs.build_id }}/amazon-cloudwatch-agent.msi + aws s3 cp --no-progress ./amazon-cloudwatch-agent.msi s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/packaging/${{ inputs.build_id }}/amazon-cloudwatch-agent.msi popd pushd linux/amd64 unzip AmazonCloudWatchAgent.zip - aws s3 cp ./amazon-cloudwatch-agent.rpm s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.rpm - aws s3 cp ./amazon-cloudwatch-agent.deb s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.deb + aws s3 cp --no-progress ./amazon-cloudwatch-agent.rpm s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.rpm + aws s3 cp --no-progress ./amazon-cloudwatch-agent.deb s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.deb popd pushd linux/arm64 unzip AmazonCloudWatchAgent.zip - aws s3 cp ./amazon-cloudwatch-agent.rpm s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/arm64/amazon-cloudwatch-agent.rpm - aws s3 cp ./amazon-cloudwatch-agent.deb s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.deb + aws s3 cp --no-progress ./amazon-cloudwatch-agent.rpm s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/arm64/amazon-cloudwatch-agent.rpm + aws s3 cp --no-progress ./amazon-cloudwatch-agent.deb s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.deb popd pushd darwin/amd64 unzip AmazonCloudWatchAgent.zip - aws s3 cp ./amazon-cloudwatch-agent.pkg s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/packaging/${{ inputs.build_id }}/arm64/amazon-cloudwatch-agent.pkg + aws s3 cp --no-progress ./amazon-cloudwatch-agent.pkg s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/packaging/${{ inputs.build_id }}/arm64/amazon-cloudwatch-agent.pkg popd pushd darwin/arm64 unzip AmazonCloudWatchAgent.zip - aws s3 cp ./amazon-cloudwatch-agent.pkg s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/packaging/${{ inputs.build_id }}/arm64/amazon-cloudwatch-agent.pkg + aws s3 cp --no-progress ./amazon-cloudwatch-agent.pkg s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/packaging/${{ inputs.build_id }}/arm64/amazon-cloudwatch-agent.pkg popd From 0d5c55fa8755b71be21beba2f1f7ec190f02b822 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Fri, 7 Feb 2025 10:12:51 -0500 Subject: [PATCH 21/39] Re-add checkout/go setup for generating matrix --- .github/workflows/integration-test-s3.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/integration-test-s3.yml index fb47ef6b33..074c0bd428 100644 --- a/.github/workflows/integration-test-s3.yml +++ b/.github/workflows/integration-test-s3.yml @@ -70,6 +70,7 @@ jobs: GenerateTestMatrix: name: 'GenerateTestMatrix' + needs: [OutputEnvVariables] runs-on: ubuntu-latest outputs: ec2_gpu_matrix: ${{ steps.set-matrix.outputs.ec2_gpu_matrix }} @@ -88,6 +89,16 @@ jobs: 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: + repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + + - name: Set up Go 1.x + uses: actions/setup-go@v4 + with: + go-version: ~1.22.2 + - name: Generate matrix id: set-matrix run: | From d7f1465c3fc4de895007bfc88c9a43366d39cb0f Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Fri, 7 Feb 2025 11:27:38 -0500 Subject: [PATCH 22/39] Re-add matrix generation --- .github/workflows/integration-test-s3.yml | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/integration-test-s3.yml index 074c0bd428..cd772ea488 100644 --- a/.github/workflows/integration-test-s3.yml +++ b/.github/workflows/integration-test-s3.yml @@ -103,15 +103,39 @@ jobs: id: set-matrix run: | go run --tags=generator generator/test_case_generator.go + echo "ec2_gpu_matrix=$(echo $(cat generator/resources/ec2_gpu_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "eks_addon_matrix=$(echo $(cat generator/resources/eks_addon_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" echo "ec2_linux_matrix=$(echo $(cat generator/resources/ec2_linux_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" echo "ec2_windows_matrix=$(echo $(cat generator/resources/ec2_windows_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" echo "ec2_mac_matrix=$(echo $(cat generator/resources/ec2_mac_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_performance_matrix=$(echo $(cat generator/resources/ec2_performance_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_windows_performance_matrix=$(echo $(cat generator/resources/ec2_windows_performance_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_stress_matrix=$(echo $(cat generator/resources/ec2_stress_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_windows_stress_matrix=$(echo $(cat generator/resources/ec2_windows_stress_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ecs_ec2_launch_daemon_matrix=$(echo $(cat generator/resources/ecs_ec2_daemon_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ecs_fargate_matrix=$(echo $(cat generator/resources/ecs_fargate_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "eks_daemon_matrix=$(echo $(cat generator/resources/eks_daemon_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "eks_deployment_matrix=$(echo $(cat generator/resources/eks_deployment_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_linux_itar_matrix=$(echo $(cat generator/resources/ec2_linux_itar_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" + echo "ec2_linux_china_matrix=$(echo $(cat generator/resources/ec2_linux_china_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" - name: Echo test plan matrix run: | + echo "ec2_gpu_matrix: ${{ steps.set-matrix.outputs.ec2_gpu_matrix }}" + echo "eks_addon_matrix: ${{ steps.set-matrix.outputs.eks_addon_matrix }}" echo "ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_matrix }}" echo "ec2_windows_matrix: ${{ steps.set-matrix.outputs.ec2_windows_matrix }}" echo "ec2_mac_matrix: ${{ steps.set-matrix.outputs.ec2_mac_matrix }}" + echo "ec2_performance_matrix: ${{ steps.set-matrix.outputs.ec2_performance_matrix}}" + echo "ec2_windows_performance_matrix: ${{ steps.set-matrix.outputs.ec2_windows_performance_matrix}}" + echo "ec2_stress_matrix: ${{ steps.set-matrix.outputs.ec2_stress_matrix}}" + echo "ec2_windows_stress_matrix: ${{ steps.set-matrix.outputs.ec2_windows_stress_matrix}}" + echo "ecs_ec2_launch_daemon_matrix: ${{ steps.set-matrix.outputs.ecs_ec2_launch_daemon_matrix }}" + echo "ecs_fargate_matrix: ${{ steps.set-matrix.outputs.ecs_fargate_matrix }}" + echo "eks_daemon_matrix: ${{ steps.set-matrix.outputs.eks_daemon_matrix }}" + echo "eks_deployment_matrix: ${{ steps.set-matrix.outputs.eks_deployment_matrix }}" + echo "ec2_linux_itar_matrix: ${{ steps.set-matrix.outputs.ec2_linux_itar_matrix }}" + echo "ec2_linux_china_matrix: ${{ steps.set-matrix.outputs.ec2_linux_china_matrix }}" CloudformationTest: needs: [OutputEnvVariables, GenerateTestMatrix] From b31470c1e7f72b17fdd95fa6301e3a54db8cd89c Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Fri, 7 Feb 2025 14:39:06 -0500 Subject: [PATCH 23/39] Fix path for arm --- .github/workflows/release-candidate-test.yml | 2 +- .github/workflows/start-localstack.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml index 9ee786aa17..891b78505f 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/release-candidate-test.yml @@ -127,7 +127,7 @@ jobs: pushd linux/arm64 unzip AmazonCloudWatchAgent.zip aws s3 cp --no-progress ./amazon-cloudwatch-agent.rpm s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/arm64/amazon-cloudwatch-agent.rpm - aws s3 cp --no-progress ./amazon-cloudwatch-agent.deb s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.deb + aws s3 cp --no-progress ./amazon-cloudwatch-agent.deb s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/arm64/amazon-cloudwatch-agent.deb popd pushd darwin/amd64 diff --git a/.github/workflows/start-localstack.yml b/.github/workflows/start-localstack.yml index 53123dac76..4a187cdcc4 100644 --- a/.github/workflows/start-localstack.yml +++ b/.github/workflows/start-localstack.yml @@ -83,5 +83,5 @@ jobs: -var="ssh_key_name=${{env.KEY_NAME}}" && LOCAL_STACK_HOST_NAME=$(terraform output -raw public_dns) && echo $LOCAL_STACK_HOST_NAME && - echo "::set-output name=local_stack_host_name::$LOCAL_STACK_HOST_NAME" && + echo "local_stack_host_name=$LOCAL_STACK_HOST_NAME" >> "$GITHUB_OUTPUT" && aws s3 cp terraform.tfstate s3://${{inputs.s3_integration_bucket}}/integration-test/local-stack-terraform-state/${{inputs.github_sha}}/terraform.tfstate From f676c1f37fb9c35db9a96fcc261b9c149a9b8820 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Fri, 7 Feb 2025 15:09:57 -0500 Subject: [PATCH 24/39] Fix agent path in cftest --- .github/workflows/integration-test-s3.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/integration-test-s3.yml index cd772ea488..03adcab8cd 100644 --- a/.github/workflows/integration-test-s3.yml +++ b/.github/workflows/integration-test-s3.yml @@ -168,7 +168,7 @@ jobs: - name: Test cf run: | cd test/test/cloudformation - go test -timeout 1h -package_path=s3://${{ vars.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_sha }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent + go test -timeout 1h -package_path=s3://${{ vars.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent StartLocalStack: name: 'StartLocalStack' From 4fc6de703dd693705d2d527491820cf26b7a0037 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Fri, 7 Feb 2025 17:06:20 -0500 Subject: [PATCH 25/39] workflow updates --- .github/workflows/integration-test-s3.yml | 164 ++++++++++--------- .github/workflows/integration-test.yml | 4 +- .github/workflows/release-candidate-test.yml | 60 +------ .github/workflows/stop-localstack.yml | 3 + 4 files changed, 102 insertions(+), 129 deletions(-) diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/integration-test-s3.yml index 03adcab8cd..6349457427 100644 --- a/.github/workflows/integration-test-s3.yml +++ b/.github/workflows/integration-test-s3.yml @@ -1,7 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT -name: Run Integration Tests on S3 +name: Run Integration Tests for Artifacts env: PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY }} TERRAFORM_AWS_ASSUME_ROLE: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} @@ -26,8 +26,14 @@ on: description: 'The build ID (release candidate build number or GitHub commit SHA)' type: string required: true + artifacts_ecr_registry: + description: 'Override for the ECR repository which holds the agent image' + type: string + artifacts_ecr_repo: + description: 'Override for the ECR repository which holds the agent image' + type: string test_repo_branch: - description: 'Override for the test repo branch (default is main)' + description: 'Override for the GitHub test repository branch to use (default is main)' type: string concurrency: @@ -47,16 +53,20 @@ jobs: id: set-outputs run: | CWA_GITHUB_TEST_REPO_BRANCH=${{ inputs.test_repo_branch }} + ARTIFACTS_ECR_REPO=${{ inputs.artifacts_ecr_repo + }} echo "CWA_GITHUB_TEST_REPO_NAME=${{ env.CWA_GITHUB_TEST_REPO_NAME }}" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_URL=${{ env.CWA_GITHUB_TEST_REPO_URL }}" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_BRANCH=${CWA_GITHUB_TEST_REPO_BRANCH:-${{ env.CWA_GITHUB_TEST_REPO_BRANCH }}}" >> "$GITHUB_OUTPUT" + echo "ARTIFACTS_ECR_REPO=${ARTIFACTS_ECR_REPO:-${{ env.ECR_INTEGRATION_TEST_REPO }}}" >> "$GITHUB_OUTPUT" - name: Echo test variables run: | echo "CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}" echo "CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}" echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" + echo "ARTIFACTS_ECR_REPO: ${{ steps.set-outputs.outputs.ARTIFACTS_ECR_REPO }}" - uses: actions/checkout@v3 with: @@ -617,81 +627,83 @@ jobs: # github_sha: ${{inputs.build_id}} # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} - # ECSEC2IntegrationTest: - # name: 'ECSEC2IntegrationTest' - # runs-on: ubuntu-latest - # needs: [ GenerateTestMatrix ] - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ecs_ec2_launch_daemon_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - # - name: Login ECR - # id: login-ecr - # uses: aws-actions/amazon-ecr-login@v2 + ECSEC2IntegrationTest: + name: 'ECSEC2IntegrationTest' + runs-on: ubuntu-latest + needs: [ GenerateTestMatrix, OutputEnvVariables ] + strategy: + fail-fast: false + matrix: + arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ecs_ec2_launch_daemon_matrix) }} + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + with: + repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - # - name: Verify Terraform version - # run: terraform --version + - name: Login ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + with: + registries: ${{ vars.RELEASE_ARTIFACTS_ACCOUNT_ID }} - # - name: Terraform apply - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 15 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ecs_ec2/daemon - # fi + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 - # terraform init - # if terraform apply --auto-approve\ - # -var="test_dir=${{ matrix.arrays.test_dir }}"\ - # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ - # -var="cwagent_image_tag=${{ inputs.build_id }}"\ - # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="metadataEnabled=${{ matrix.arrays.metadataEnabled }}" \ - # -var="ami=${{ matrix.arrays.ami }}" ; then - # terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi + - name: Verify Terraform version + run: terraform --version - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ecs_ec2/daemon - # fi - # terraform destroy --auto-approve + - name: Terraform apply + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 15 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/ecs_ec2/daemon + fi + + terraform init + if terraform apply --auto-approve\ + -var="test_dir=${{ matrix.arrays.test_dir }}"\ + -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ needs.OutputEnvVariables.outputs.ARTIFACTS_ECR_REPO }}"\ + -var="cwagent_image_tag=${{ inputs.build_id }}"\ + -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + -var="metadataEnabled=${{ matrix.arrays.metadataEnabled }}" \ + -var="ami=${{ matrix.arrays.ami }}" ; then + terraform destroy -auto-approve + else + terraform destroy -auto-approve && exit 1 + fi + + - name: Terraform destroy + if: ${{ cancelled() || failure() }} + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 8 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/ecs_ec2/daemon + fi + terraform destroy --auto-approve # ECSFargateIntegrationTest: # name: 'ECSFargateIntegrationTest' @@ -743,7 +755,7 @@ jobs: # terraform init # if terraform apply --auto-approve\ # -var="test_dir=${{ matrix.arrays.test_dir }}"\ - # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ + # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ARTIFACTS_ECR_REPO }}"\ # -var="cwagent_image_tag=${{ inputs.build_id }}"; then # terraform destroy -auto-approve # else @@ -814,7 +826,7 @@ jobs: # terraform init # if terraform apply --auto-approve \ # -var="test_dir=${{ matrix.arrays.test_dir }}"\ - # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \ + # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ARTIFACTS_ECR_REPO }}" \ # -var="cwagent_image_tag=${{ inputs.build_id }}" \ # -var="ami_type=${{ matrix.arrays.ami }}" \ # -var="instance_type=${{ matrix.arrays.instanceType }}" \ @@ -889,7 +901,7 @@ jobs: # terraform init # if terraform apply --auto-approve \ # -var="test_dir=${{ matrix.arrays.test_dir }}"\ - # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \ + # -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ARTIFACTS_ECR_REPO }}" \ # -var="cwagent_image_tag=${{ inputs.build_id }}" \ # -var="k8s_version=${{ matrix.arrays.k8s_version }}"; then # terraform destroy -auto-approve @@ -1219,7 +1231,7 @@ jobs: # EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name) # echo "Cluster name is ${EKS_CLUSTER_NAME}" # kubectl create -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.17.0/deployments/static/nvidia-device-plugin.yml - # kubectl patch amazoncloudwatchagents -n amazon-cloudwatch cloudwatch-agent --type='json' -p='[{"op": "replace", "path": "/spec/image", "value": ${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/${{ env.ECR_INTEGRATION_TEST_REPO }}:${{ inputs.build_id }}}]' + # kubectl patch amazoncloudwatchagents -n amazon-cloudwatch cloudwatch-agent --type='json' -p='[{"op": "replace", "path": "/spec/image", "value": ${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/${{ env.ARTIFACTS_ECR_REPO }}:${{ inputs.build_id }}}]' # # wait nvidia device plugin to be ready # sleep 10 # kubectl apply -f ./gpuBurner.yaml diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 4a54968bf7..fbe73bbde0 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-latest steps: - run: | - if [[ ${{ inputs.build_sha }} == ${{ github.sha }} ]]; then + if [[ ${{ inputs.build_id }} == ${{ github.sha }} ]]; then echo "Build SHA matches test SHA" else echo "Build SHA does not match test SHA" @@ -157,7 +157,7 @@ jobs: - name: Test cf run: | cd test/test/cloudformation - go test -timeout 1h -package_path=s3://${S3_INTEGRATION_BUCKET}/integration-test/binary/${{ inputs.build_sha }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent + go test -timeout 1h -package_path=s3://${S3_INTEGRATION_BUCKET}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.rpm -iam_role=${CF_IAM_ROLE} -key_name=${CF_KEY_NAME} -metric_name=mem_used_percent StartLocalStack: name: 'StartLocalStack' diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml index 891b78505f..8ff0676f37 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/release-candidate-test.yml @@ -3,22 +3,11 @@ name: Run Integration Tests for Release Candidate env: - PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY }} TERRAFORM_AWS_ASSUME_ROLE: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} TERRAFORM_AWS_ASSUME_ROLE_DURATION: 14400 # 4 hours S3_INTEGRATION_BUCKET: ${{ vars.S3_INTEGRATION_BUCKET }} S3_RELEASE_BUCKET: amazon-cloud-watch-agent - KEY_NAME: ${{ secrets.KEY_NAME }} - CF_IAM_ROLE: ${{ secrets.CF_IAM_ROLE }} - CF_KEY_NAME: ${{ secrets.CF_KEY_NAME }} - ECR_INTEGRATION_TEST_REPO: "cwagent-integration-test" - CWA_GITHUB_TEST_REPO_NAME: "aws/amazon-cloudwatch-agent-test" - CWA_GITHUB_TEST_REPO_URL: "https://github.com/aws/amazon-cloudwatch-agent-test.git" - CWA_GITHUB_TEST_REPO_BRANCH: "main" - TERRAFORM_AWS_ASSUME_ROLE_ITAR: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} - S3_INTEGRATION_BUCKET_ITAR: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} - TERRAFORM_AWS_ASSUME_ROLE_CN: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} - S3_INTEGRATION_BUCKET_CN: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + S3_RELEASE_REPO: cloudwatch-agent on: workflow_dispatch: @@ -37,39 +26,6 @@ concurrency: cancel-in-progress: true jobs: - OutputEnvVariables: - name: 'OutputEnvVariables' - runs-on: ubuntu-latest - outputs: - CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }} - CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }} - CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - steps: - - name: SetOutputs - id: set-outputs - run: | - CWA_GITHUB_TEST_REPO_BRANCH=${{ inputs.test_repo_branch }} - - echo "CWA_GITHUB_TEST_REPO_NAME=${{ env.CWA_GITHUB_TEST_REPO_NAME }}" >> "$GITHUB_OUTPUT" - echo "CWA_GITHUB_TEST_REPO_URL=${{ env.CWA_GITHUB_TEST_REPO_URL }}" >> "$GITHUB_OUTPUT" - echo "CWA_GITHUB_TEST_REPO_BRANCH=${CWA_GITHUB_TEST_REPO_BRANCH:-${{ env.CWA_GITHUB_TEST_REPO_BRANCH }}}" >> "$GITHUB_OUTPUT" - - - name: Echo test variables - run: | - echo "CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}" - echo "CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}" - echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" - - - uses: actions/checkout@v3 - with: - repository: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }} - ref: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - - - name: Set up Go 1.x - uses: actions/setup-go@v4 - with: - go-version: ~1.22.2 - RepackageReleaseCandidate: name: 'RepackageReleaseCandidate' runs-on: ubuntu-latest @@ -79,12 +35,6 @@ jobs: id-token: write contents: read steps: - - uses: actions/checkout@v3 - with: - repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}} - ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}} - path: test - - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v2 with: @@ -139,3 +89,11 @@ jobs: unzip AmazonCloudWatchAgent.zip aws s3 cp --no-progress ./amazon-cloudwatch-agent.pkg s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/packaging/${{ inputs.build_id }}/arm64/amazon-cloudwatch-agent.pkg popd + + StartIntegrationTests: + needs: [ RepackageReleaseCandidate ] + runs-on: ubuntu-latest + steps: + - run: gh workflow run integration-test-s3.yml --ref ${{ github.ref_name }} --repo $GITHUB_REPOSITORY -f build_id=${{ inputs.build_id }} -f ecr_rest_repo=${{ env.S3_RELEASE_REPO }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/stop-localstack.yml b/.github/workflows/stop-localstack.yml index 248e3e85ca..8f0f100ca6 100644 --- a/.github/workflows/stop-localstack.yml +++ b/.github/workflows/stop-localstack.yml @@ -53,6 +53,9 @@ jobs: - name: Copy state run: aws s3 cp s3://${{inputs.s3_integration_bucket}}/integration-test/local-stack-terraform-state/${{inputs.github_sha}}/terraform.tfstate . + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 + - name: Verify Terraform version run: terraform --version From 7534f27c9ea1060d4ec7b75e91c2e0012ec5803a Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Mon, 10 Feb 2025 09:13:17 -0500 Subject: [PATCH 26/39] Upload to cn and itar --- .github/workflows/release-candidate-test.yml | 48 +++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml index 8ff0676f37..cf825c944c 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/release-candidate-test.yml @@ -1,13 +1,17 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT -name: Run Integration Tests for Release Candidate +name: Test Release Candidate env: TERRAFORM_AWS_ASSUME_ROLE: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} TERRAFORM_AWS_ASSUME_ROLE_DURATION: 14400 # 4 hours S3_INTEGRATION_BUCKET: ${{ vars.S3_INTEGRATION_BUCKET }} S3_RELEASE_BUCKET: amazon-cloud-watch-agent S3_RELEASE_REPO: cloudwatch-agent + TERRAFORM_AWS_ASSUME_ROLE_ITAR: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + S3_INTEGRATION_BUCKET_ITAR: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + TERRAFORM_AWS_ASSUME_ROLE_CN: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + S3_INTEGRATION_BUCKET_CN: ${{ vars.S3_INTEGRATION_BUCKET_CN }} on: workflow_dispatch: @@ -61,7 +65,7 @@ jobs: aws s3 cp --no-progress s3://${{ env.S3_RELEASE_BUCKET }}/darwin/arm64/${{ inputs.build_id }}/AmazonCloudWatchAgent.zip ./darwin/arm64 - name: Re-upload Artifacts - id: uncompress-artifacts + id: upload-artifacts run: | pushd windows/amd64/ unzip AmazonCloudWatchAgent.zip @@ -90,6 +94,46 @@ jobs: aws s3 cp --no-progress ./amazon-cloudwatch-agent.pkg s3://${{ env.S3_INTEGRATION_BUCKET }}/integration-test/packaging/${{ inputs.build_id }}/arm64/amazon-cloudwatch-agent.pkg popd + - name: Configure AWS Credentials (CN) + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_CN }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + - name: Re-upload Artifacts (CN) + id: upload-artifacts-cn + run: | + pushd linux/amd64 + aws --region cn-north-1 s3 cp --no-progress ./amazon-cloudwatch-agent.rpm s3://${{ env.S3_INTEGRATION_BUCKET_CN }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.rpm + aws --region cn-north-1 s3 cp --no-progress ./amazon-cloudwatch-agent.deb s3://${{ env.S3_INTEGRATION_BUCKET_CN }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.deb + popd + + pushd linux/arm64 + aws --region cn-north-1 s3 cp --no-progress ./amazon-cloudwatch-agent.rpm s3://${{ env.S3_INTEGRATION_BUCKET_CN }}/integration-test/binary/${{ inputs.build_id }}/linux/arm64/amazon-cloudwatch-agent.rpm + aws --region cn-north-1 s3 cp --no-progress ./amazon-cloudwatch-agent.deb s3://${{ env.S3_INTEGRATION_BUCKET_CN }}/integration-test/binary/${{ inputs.build_id }}/linux/arm64/amazon-cloudwatch-agent.deb + popd + + - name: Configure AWS Credentials (ITAR) + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + - name: Re-upload Artifacts (ITAR) + id: upload-artifacts-itar + run: | + pushd linux/amd64 + aws --region us-gov-east-1 s3 cp --no-progress ./amazon-cloudwatch-agent.rpm s3://${{ env.S3_INTEGRATION_BUCKET_ITAR }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.rpm + aws --region us-gov-east-1 s3 cp --no-progress ./amazon-cloudwatch-agent.deb s3://${{ env.S3_INTEGRATION_BUCKET_ITAR }}/integration-test/binary/${{ inputs.build_id }}/linux/amd64/amazon-cloudwatch-agent.deb + popd + + pushd linux/arm64 + aws --region us-gov-east-1 s3 cp --no-progress ./amazon-cloudwatch-agent.rpm s3://${{ env.S3_INTEGRATION_BUCKET_ITAR }}/integration-test/binary/${{ inputs.build_id }}/linux/arm64/amazon-cloudwatch-agent.rpm + aws --region us-gov-east-1 s3 cp --no-progress ./amazon-cloudwatch-agent.deb s3://${{ env.S3_INTEGRATION_BUCKET_ITAR }}/integration-test/binary/${{ inputs.build_id }}/linux/arm64/amazon-cloudwatch-agent.deb + popd + StartIntegrationTests: needs: [ RepackageReleaseCandidate ] runs-on: ubuntu-latest From 532e939e25719db06c76e85dbf390d030336f336 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Mon, 10 Feb 2025 09:19:12 -0500 Subject: [PATCH 27/39] Fix regions for credentials --- .github/workflows/release-candidate-test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml index cf825c944c..75b2433566 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/release-candidate-test.yml @@ -40,7 +40,7 @@ jobs: contents: read steps: - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 + uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} aws-region: us-west-2 @@ -95,10 +95,10 @@ jobs: popd - name: Configure AWS Credentials (CN) - uses: aws-actions/configure-aws-credentials@v2 + uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_CN }} - aws-region: us-west-2 + aws-region: cn-north-1 role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - name: Re-upload Artifacts (CN) @@ -115,10 +115,10 @@ jobs: popd - name: Configure AWS Credentials (ITAR) - uses: aws-actions/configure-aws-credentials@v2 + uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} - aws-region: us-west-2 + aws-region: us-gov-east-1 role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - name: Re-upload Artifacts (ITAR) From 07c73ebca05f9b825eeb1ed9219726df33f9a229 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Mon, 10 Feb 2025 10:29:59 -0500 Subject: [PATCH 28/39] reupload agent image --- ...st.yml => repackage-release-artifacts.yml} | 56 ++-- ...gration-test-s3.yml => test-artifacts.yml} | 256 +++++++++--------- .github/workflows/test-release-candidate.yml | 45 +++ 3 files changed, 212 insertions(+), 145 deletions(-) rename .github/workflows/{release-candidate-test.yml => repackage-release-artifacts.yml} (83%) rename .github/workflows/{integration-test-s3.yml => test-artifacts.yml} (88%) create mode 100644 .github/workflows/test-release-candidate.yml diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/repackage-release-artifacts.yml similarity index 83% rename from .github/workflows/release-candidate-test.yml rename to .github/workflows/repackage-release-artifacts.yml index 75b2433566..6506418de3 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/repackage-release-artifacts.yml @@ -1,7 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT -name: Test Release Candidate +name: Repackage Release Artifacts env: TERRAFORM_AWS_ASSUME_ROLE: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} TERRAFORM_AWS_ASSUME_ROLE_DURATION: 14400 # 4 hours @@ -14,24 +14,16 @@ env: S3_INTEGRATION_BUCKET_CN: ${{ vars.S3_INTEGRATION_BUCKET_CN }} on: - workflow_dispatch: + workflow_call: inputs: build_id: description: 'The build ID (release candidate build number or GitHub commit SHA)' type: string required: true - test_repo_branch: - description: 'Override for the test repo branch (default is main)' - type: string - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true jobs: - RepackageReleaseCandidate: - name: 'RepackageReleaseCandidate' + RepackageReleaseArtifcats: + name: 'RepackageReleaseArtifcats' runs-on: ubuntu-latest strategy: fail-fast: false @@ -134,10 +126,40 @@ jobs: aws --region us-gov-east-1 s3 cp --no-progress ./amazon-cloudwatch-agent.deb s3://${{ env.S3_INTEGRATION_BUCKET_ITAR }}/integration-test/binary/${{ inputs.build_id }}/linux/arm64/amazon-cloudwatch-agent.deb popd - StartIntegrationTests: - needs: [ RepackageReleaseCandidate ] + RepackageUploadImage: + name: 'RepackageUploadImage' runs-on: ubuntu-latest + strategy: + fail-fast: false + permissions: + id-token: write + contents: read steps: - - run: gh workflow run integration-test-s3.yml --ref ${{ github.ref_name }} --repo $GITHUB_REPOSITORY -f build_id=${{ inputs.build_id }} -f ecr_rest_repo=${{ env.S3_RELEASE_REPO }} - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + - name: Login to Release Artifacts Amazon ECR + id: login-artifacts-ecr + uses: aws-actions/amazon-ecr-login@v2 + with: + registries: ${{ vars.RELEASE_ARTIFACTS_ACCOUNT_ID }} + + - name: Pull Image + id: pull-image + run: | + docker pull ${{ vars.RELEASE_ARTIFACTS_ACCOUNT_ID }}.dkr.ecr.us-west-2.amazonaws.com/cloudwatch-agent:${{ inputs.build_id }} + + - name: Login to Integ Test Amazon ECR + id: login-integt-test-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Push Image + id: push-image + run: | + docker tag cloudwatch-agent:${{ inputs.build_id }} ${{ vars.AWS_ECR_PRIVATE_REGISTRY}}/cloudwatch-agent:${{ inputs.build_id }} + + diff --git a/.github/workflows/integration-test-s3.yml b/.github/workflows/test-artifacts.yml similarity index 88% rename from .github/workflows/integration-test-s3.yml rename to .github/workflows/test-artifacts.yml index 6349457427..8004e9b038 100644 --- a/.github/workflows/integration-test-s3.yml +++ b/.github/workflows/test-artifacts.yml @@ -1,7 +1,7 @@ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT -name: Run Integration Tests for Artifacts +name: Test Artifacts env: PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY }} TERRAFORM_AWS_ASSUME_ROLE: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} @@ -26,11 +26,11 @@ on: description: 'The build ID (release candidate build number or GitHub commit SHA)' type: string required: true - artifacts_ecr_registry: + ecr_registry: description: 'Override for the ECR repository which holds the agent image' type: string - artifacts_ecr_repo: - description: 'Override for the ECR repository which holds the agent image' + ecr_repo: + description: 'Override for the ECR repository which holds the agent image (default is cwagent-integration-test)' type: string test_repo_branch: description: 'Override for the GitHub test repository branch to use (default is main)' @@ -53,8 +53,8 @@ jobs: id: set-outputs run: | CWA_GITHUB_TEST_REPO_BRANCH=${{ inputs.test_repo_branch }} - ARTIFACTS_ECR_REPO=${{ inputs.artifacts_ecr_repo - }} + ECR_REPO=${{ inputs.ecr_repo }} + ECR_REGISTRY=${{ inputs.ecr_registry }} echo "CWA_GITHUB_TEST_REPO_NAME=${{ env.CWA_GITHUB_TEST_REPO_NAME }}" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_URL=${{ env.CWA_GITHUB_TEST_REPO_URL }}" >> "$GITHUB_OUTPUT" @@ -197,39 +197,39 @@ jobs: github_sha: ${{inputs.build_id}} s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} - # StartLocalStackITAR: - # name: 'StartLocalStackITAR' - # needs: [OutputEnvVariables] - # uses: ./.github/workflows/start-localstack.yml - # secrets: inherit - # permissions: - # id-token: write - # contents: read - # with: - # region: us-gov-east-1 - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # github_sha: ${{inputs.build_id}} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} - - # StartLocalStackCN: - # name: 'StartLocalStackCN' - # needs: [ OutputEnvVariables ] - # uses: ./.github/workflows/start-localstack.yml - # secrets: inherit - # permissions: - # id-token: write - # contents: read - # with: - # region: cn-north-1 - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # github_sha: ${{inputs.build_id}} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + StartLocalStackITAR: + name: 'StartLocalStackITAR' + needs: [OutputEnvVariables] + uses: ./.github/workflows/start-localstack.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + region: us-gov-east-1 + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + github_sha: ${{inputs.build_id}} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + + StartLocalStackCN: + name: 'StartLocalStackCN' + needs: [ OutputEnvVariables ] + uses: ./.github/workflows/start-localstack.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + region: cn-north-1 + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + github_sha: ${{inputs.build_id}} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} @@ -365,61 +365,61 @@ jobs: s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} secrets: inherit - # EC2LinuxIntegrationTestITAR: - # needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] - # name: 'EC2LinuxITAR' - # uses: ./.github/workflows/ec2-integration-test.yml - # with: - # github_sha: ${{inputs.build_id}} - # test_dir: terraform/ec2/linux - # job_id: ec2-linux-integration-test - # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_itar_matrix}} - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # localstack_host: ${{needs.StartLocalStackITAR.outputs.local_stack_host_name}} - # region: us-gov-east-1 - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} - # secrets: inherit - - # EC2LinuxIntegrationTestCN: - # needs: [ StartLocalStackCN, GenerateTestMatrix, OutputEnvVariables ] - # name: 'EC2LinuxCN' - # uses: ./.github/workflows/ec2-integration-test.yml - # with: - # github_sha: ${{inputs.build_id}} - # test_dir: terraform/ec2/linux - # job_id: ec2-linux-integration-test - # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_china_matrix}} - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # localstack_host: ${{needs.StartLocalStackCN.outputs.local_stack_host_name}} - # region: cn-north-1 - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} - # secrets: inherit - - - # LinuxOnPremIntegrationTest: - # needs: [StartLocalStack, GenerateTestMatrix, OutputEnvVariables] - # name: 'OnpremLinux' - # uses: ./.github/workflows/ec2-integration-test.yml - # with: - # github_sha: ${{inputs.build_id}} - # test_dir: terraform/ec2/linux_onprem - # job_id: linux-onprem-integration-test - # test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_onprem_matrix}} - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} - # region: us-west-2 - # agent_s3_path_linux: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }} - # agent_s3_path_windows: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }} - # agent_s3_path_mac: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }} - # secrets: inherit + EC2LinuxIntegrationTestITAR: + needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] + name: 'EC2LinuxITAR' + uses: ./.github/workflows/ec2-integration-test.yml + with: + github_sha: ${{inputs.build_id}} + test_dir: terraform/ec2/linux + job_id: ec2-linux-integration-test + test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_itar_matrix}} + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + localstack_host: ${{needs.StartLocalStackITAR.outputs.local_stack_host_name}} + region: us-gov-east-1 + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + secrets: inherit + + EC2LinuxIntegrationTestCN: + needs: [ StartLocalStackCN, GenerateTestMatrix, OutputEnvVariables ] + name: 'EC2LinuxCN' + uses: ./.github/workflows/ec2-integration-test.yml + with: + github_sha: ${{inputs.build_id}} + test_dir: terraform/ec2/linux + job_id: ec2-linux-integration-test + test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_china_matrix}} + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + localstack_host: ${{needs.StartLocalStackCN.outputs.local_stack_host_name}} + region: cn-north-1 + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + secrets: inherit + + + LinuxOnPremIntegrationTest: + needs: [StartLocalStack, GenerateTestMatrix, OutputEnvVariables] + name: 'OnpremLinux' + uses: ./.github/workflows/ec2-integration-test.yml + with: + github_sha: ${{inputs.build_id}} + test_dir: terraform/ec2/linux_onprem + job_id: linux-onprem-integration-test + test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_onprem_matrix}} + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} + region: us-west-2 + agent_s3_path_linux: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }} + agent_s3_path_windows: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }} + agent_s3_path_mac: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }} + secrets: inherit # EC2WinIntegrationTest: # needs: [OutputEnvVariables, GenerateTestMatrix] @@ -579,7 +579,7 @@ jobs: StopLocalStack: name: 'StopLocalStack' if: ${{ always() && needs.StartLocalStack.result == 'success' }} - needs: [ StartLocalStack, EC2LinuxIntegrationTest, OutputEnvVariables ] + needs: [ StartLocalStack, EC2LinuxIntegrationTest, LinuxOnPremIntegrationTest, OutputEnvVariables ] uses: ./.github/workflows/stop-localstack.yml secrets: inherit permissions: @@ -593,39 +593,39 @@ jobs: github_sha: ${{inputs.build_id}} s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} - # StopLocalStackITAR: - # name: 'StopLocalStackITAR' - # if: ${{ always() && needs.StartLocalStackITAR.result == 'success' }} - # needs: [ StartLocalStackITAR, EC2LinuxIntegrationTestITAR, OutputEnvVariables ] - # uses: ./.github/workflows/stop-localstack.yml - # secrets: inherit - # permissions: - # id-token: write - # contents: read - # with: - # region: us-gov-east-1 - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} - # github_sha: ${{inputs.build_id}} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} - - # StopLocalStackCN: - # name: 'StopLocalStackCN' - # if: ${{ always() && needs.StartLocalStackCN.result == 'success' }} - # needs: [ StartLocalStackCN, EC2LinuxIntegrationTestCN ] - # uses: ./.github/workflows/stop-localstack.yml - # secrets: inherit - # permissions: - # id-token: write - # contents: read - # with: - # region: cn-north-1 - # test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} - # github_sha: ${{inputs.build_id}} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + StopLocalStackITAR: + name: 'StopLocalStackITAR' + if: ${{ always() && needs.StartLocalStackITAR.result == 'success' }} + needs: [ StartLocalStackITAR, EC2LinuxIntegrationTestITAR, OutputEnvVariables ] + uses: ./.github/workflows/stop-localstack.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + region: us-gov-east-1 + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + github_sha: ${{inputs.build_id}} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + + StopLocalStackCN: + name: 'StopLocalStackCN' + if: ${{ always() && needs.StartLocalStackCN.result == 'success' }} + needs: [ StartLocalStackCN, EC2LinuxIntegrationTestCN ] + uses: ./.github/workflows/stop-localstack.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + region: cn-north-1 + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + github_sha: ${{inputs.build_id}} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} ECSEC2IntegrationTest: name: 'ECSEC2IntegrationTest' diff --git a/.github/workflows/test-release-candidate.yml b/.github/workflows/test-release-candidate.yml new file mode 100644 index 0000000000..b59d4342a3 --- /dev/null +++ b/.github/workflows/test-release-candidate.yml @@ -0,0 +1,45 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: MIT + +name: Test Release Candidate +env: + TERRAFORM_AWS_ASSUME_ROLE: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} + TERRAFORM_AWS_ASSUME_ROLE_DURATION: 14400 # 4 hours + S3_INTEGRATION_BUCKET: ${{ vars.S3_INTEGRATION_BUCKET }} + S3_RELEASE_BUCKET: amazon-cloud-watch-agent + S3_RELEASE_REPO: cloudwatch-agent + TERRAFORM_AWS_ASSUME_ROLE_ITAR: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} + S3_INTEGRATION_BUCKET_ITAR: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} + TERRAFORM_AWS_ASSUME_ROLE_CN: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + S3_INTEGRATION_BUCKET_CN: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + +on: + workflow_dispatch: + inputs: + build_id: + description: 'The build ID (release candidate build number or GitHub commit SHA)' + type: string + required: true + test_repo_branch: + description: 'Override for the test repo branch (default is main)' + type: string + +jobs: + RepackageArtifacts: + name: 'RepackageArtifacts' + uses: ./.github/workflows/repackage-release-artifacts.yml + secrets: inherit + permissions: + id-token: write + contents: read + with: + build_id: ${{ inputs.build_id }} + + StartIntegrationTests: + needs: [ RepackageArtifacts ] + runs-on: ubuntu-latest + steps: + # Avoid the limit of 5 nested workflows by executing the workflow in this manner + - run: gh workflow run test-artifacts.yml --ref ${{ github.ref_name }} --repo $GITHUB_REPOSITORY -f build_id=${{ inputs.build_id }} -f ecr_rest_repo=${{ env.S3_RELEASE_REPO }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 8aa8c7b1c997bec446bfd3ce6fe3c0b2a6f12c24 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Mon, 10 Feb 2025 10:35:46 -0500 Subject: [PATCH 29/39] trigger on pull request --- .github/workflows/test-release-candidate.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-release-candidate.yml b/.github/workflows/test-release-candidate.yml index b59d4342a3..30c1f1dabb 100644 --- a/.github/workflows/test-release-candidate.yml +++ b/.github/workflows/test-release-candidate.yml @@ -23,6 +23,7 @@ on: test_repo_branch: description: 'Override for the test repo branch (default is main)' type: string + pull_request: jobs: RepackageArtifacts: From 07dbf70ee63fdc23d8a05b7a73748f24ea5e6d10 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Mon, 10 Feb 2025 10:43:40 -0500 Subject: [PATCH 30/39] Push the image --- .github/workflows/repackage-release-artifacts.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/repackage-release-artifacts.yml b/.github/workflows/repackage-release-artifacts.yml index 6506418de3..3a0483d562 100644 --- a/.github/workflows/repackage-release-artifacts.yml +++ b/.github/workflows/repackage-release-artifacts.yml @@ -152,6 +152,7 @@ jobs: id: pull-image run: | docker pull ${{ vars.RELEASE_ARTIFACTS_ACCOUNT_ID }}.dkr.ecr.us-west-2.amazonaws.com/cloudwatch-agent:${{ inputs.build_id }} + docker tag cloudwatch-agent:${{ inputs.build_id }} ${{ vars.AWS_ECR_PRIVATE_REGISTRY }}/cloudwatch-agent:${{ inputs.build_id }} - name: Login to Integ Test Amazon ECR id: login-integt-test-ecr @@ -160,6 +161,6 @@ jobs: - name: Push Image id: push-image run: | - docker tag cloudwatch-agent:${{ inputs.build_id }} ${{ vars.AWS_ECR_PRIVATE_REGISTRY}}/cloudwatch-agent:${{ inputs.build_id }} + docker tag ${{ vars.AWS_ECR_PRIVATE_REGISTRY }}/cloudwatch-agent:${{ inputs.build_id }} From a0bad662594f61fc37cd833d298bbe82701ad59b Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Mon, 10 Feb 2025 10:47:51 -0500 Subject: [PATCH 31/39] Rename the release candidate file so we can run the workflow --- .../{test-release-candidate.yml => release-candidate-test.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{test-release-candidate.yml => release-candidate-test.yml} (100%) diff --git a/.github/workflows/test-release-candidate.yml b/.github/workflows/release-candidate-test.yml similarity index 100% rename from .github/workflows/test-release-candidate.yml rename to .github/workflows/release-candidate-test.yml From 6bb6a55688411473968d4589766b238f7f0c1db8 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Mon, 10 Feb 2025 10:48:28 -0500 Subject: [PATCH 32/39] Remove on pull_request --- .github/workflows/release-candidate-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml index 30c1f1dabb..b59d4342a3 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/release-candidate-test.yml @@ -23,7 +23,6 @@ on: test_repo_branch: description: 'Override for the test repo branch (default is main)' type: string - pull_request: jobs: RepackageArtifacts: From e519c1c7d71f9233ed198d005bfaf7e1155fc2c0 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Mon, 10 Feb 2025 10:50:34 -0500 Subject: [PATCH 33/39] Fix variable references --- .github/workflows/repackage-release-artifacts.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/repackage-release-artifacts.yml b/.github/workflows/repackage-release-artifacts.yml index 3a0483d562..2ca4a04e10 100644 --- a/.github/workflows/repackage-release-artifacts.yml +++ b/.github/workflows/repackage-release-artifacts.yml @@ -146,13 +146,13 @@ jobs: id: login-artifacts-ecr uses: aws-actions/amazon-ecr-login@v2 with: - registries: ${{ vars.RELEASE_ARTIFACTS_ACCOUNT_ID }} + registries: ${{ secrets.RELEASE_ARTIFACTS_ACCOUNT_ID }} - name: Pull Image id: pull-image run: | - docker pull ${{ vars.RELEASE_ARTIFACTS_ACCOUNT_ID }}.dkr.ecr.us-west-2.amazonaws.com/cloudwatch-agent:${{ inputs.build_id }} - docker tag cloudwatch-agent:${{ inputs.build_id }} ${{ vars.AWS_ECR_PRIVATE_REGISTRY }}/cloudwatch-agent:${{ inputs.build_id }} + docker pull ${{ secrets.RELEASE_ARTIFACTS_ACCOUNT_ID }}.dkr.ecr.us-west-2.amazonaws.com/cloudwatch-agent:${{ inputs.build_id }} + docker tag cloudwatch-agent:${{ inputs.build_id }} ${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/cloudwatch-agent:${{ inputs.build_id }} - name: Login to Integ Test Amazon ECR id: login-integt-test-ecr @@ -161,6 +161,6 @@ jobs: - name: Push Image id: push-image run: | - docker tag ${{ vars.AWS_ECR_PRIVATE_REGISTRY }}/cloudwatch-agent:${{ inputs.build_id }} + docker tag ${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/cloudwatch-agent:${{ inputs.build_id }} From 262ffe375ae285df7fe3f944059ef7bac6ba9c8d Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Mon, 10 Feb 2025 10:59:46 -0500 Subject: [PATCH 34/39] rework variables --- .github/workflows/repackage-release-artifacts.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/repackage-release-artifacts.yml b/.github/workflows/repackage-release-artifacts.yml index 2ca4a04e10..cda2d570ce 100644 --- a/.github/workflows/repackage-release-artifacts.yml +++ b/.github/workflows/repackage-release-artifacts.yml @@ -150,9 +150,10 @@ jobs: - name: Pull Image id: pull-image + env: + REGISTRY: ${{ steps.login-artifacts-ecr.outputs.registry }} run: | - docker pull ${{ secrets.RELEASE_ARTIFACTS_ACCOUNT_ID }}.dkr.ecr.us-west-2.amazonaws.com/cloudwatch-agent:${{ inputs.build_id }} - docker tag cloudwatch-agent:${{ inputs.build_id }} ${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/cloudwatch-agent:${{ inputs.build_id }} + docker pull ${{ env.REGISTRY }}/cloudwatch-agent:${{ inputs.build_id }} - name: Login to Integ Test Amazon ECR id: login-integt-test-ecr @@ -160,7 +161,10 @@ jobs: - name: Push Image id: push-image + env: + REGISTRY: ${{ steps.login-integt-test-ecr.outputs.registry }} run: | - docker tag ${{ secrets.AWS_ECR_PRIVATE_REGISTRY }}/cloudwatch-agent:${{ inputs.build_id }} + docker tag cloudwatch-agent:${{ inputs.build_id }} ${{ env.REGISTRY }}/cwagent-integration-test:${{ inputs.build_id }} + docker tag ${{ env.REGISTRY }}/cwagent-integration-test:${{ inputs.build_id }} From 5a91e5c9dacffcea930b823a11ceac6ac5eb1fb9 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Mon, 10 Feb 2025 11:12:34 -0500 Subject: [PATCH 35/39] try to fix registry reference --- .github/workflows/repackage-release-artifacts.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/repackage-release-artifacts.yml b/.github/workflows/repackage-release-artifacts.yml index cda2d570ce..d9f434d33e 100644 --- a/.github/workflows/repackage-release-artifacts.yml +++ b/.github/workflows/repackage-release-artifacts.yml @@ -154,17 +154,18 @@ jobs: REGISTRY: ${{ steps.login-artifacts-ecr.outputs.registry }} run: | docker pull ${{ env.REGISTRY }}/cloudwatch-agent:${{ inputs.build_id }} + docker tag cloudwatch-agent:${{ inputs.build_id }} 506463145083.dkr.ecr.us-west-2.amazonaws.com/cwagent-integration-test:${{ inputs.build_id }} - name: Login to Integ Test Amazon ECR - id: login-integt-test-ecr + id: login-integ-test-ecr uses: aws-actions/amazon-ecr-login@v2 - name: Push Image id: push-image env: - REGISTRY: ${{ steps.login-integt-test-ecr.outputs.registry }} + REGISTRY: ${{ steps.login-artifacts-ecr.outputs.registry }} run: | - docker tag cloudwatch-agent:${{ inputs.build_id }} ${{ env.REGISTRY }}/cwagent-integration-test:${{ inputs.build_id }} - docker tag ${{ env.REGISTRY }}/cwagent-integration-test:${{ inputs.build_id }} + + docker push ${{ env.REGISTRY }}/cwagent-integration-test:${{ inputs.build_id }} From 6549df728e5820631070c3afbbc431770d38ef0b Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Mon, 10 Feb 2025 11:46:20 -0500 Subject: [PATCH 36/39] fix docker commands --- .github/workflows/repackage-release-artifacts.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/repackage-release-artifacts.yml b/.github/workflows/repackage-release-artifacts.yml index d9f434d33e..db4182b8b7 100644 --- a/.github/workflows/repackage-release-artifacts.yml +++ b/.github/workflows/repackage-release-artifacts.yml @@ -151,10 +151,9 @@ jobs: - name: Pull Image id: pull-image env: - REGISTRY: ${{ steps.login-artifacts-ecr.outputs.registry }} + ARTIFACTS_REGISTRY: ${{ steps.login-artifacts-ecr.outputs.registry }} run: | - docker pull ${{ env.REGISTRY }}/cloudwatch-agent:${{ inputs.build_id }} - docker tag cloudwatch-agent:${{ inputs.build_id }} 506463145083.dkr.ecr.us-west-2.amazonaws.com/cwagent-integration-test:${{ inputs.build_id }} + docker pull ${{ env.ARTIFACTS_REGISTRY }}/cloudwatch-agent:${{ inputs.build_id }} - name: Login to Integ Test Amazon ECR id: login-integ-test-ecr @@ -163,9 +162,10 @@ jobs: - name: Push Image id: push-image env: - REGISTRY: ${{ steps.login-artifacts-ecr.outputs.registry }} + ARTIFACTS_REGISTRY: ${{ steps.login-artifacts-ecr.outputs.registry }} + INTEG_TEST_REGISTRY: ${{ steps.login-artifacts-ecr.outputs.registry }} run: | - - docker push ${{ env.REGISTRY }}/cwagent-integration-test:${{ inputs.build_id }} + docker tag ${{ env.ARTIFACTS_REGISTRY }}/cloudwatch-agent:${{ inputs.build_id }} ${{ env.INTEG_TEST_REGISTRY }}/cwagent-integration-test:${{ inputs.build_id }} + docker push ${{ env.INTEG_TEST_REGISTRY }}/cwagent-integration-test:${{ inputs.build_id }} From 70798d1cbf4cbe48f4c539f9cfc37b043a2734dd Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Mon, 10 Feb 2025 12:07:19 -0500 Subject: [PATCH 37/39] Fix integ test registry --- .github/workflows/repackage-release-artifacts.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/repackage-release-artifacts.yml b/.github/workflows/repackage-release-artifacts.yml index db4182b8b7..964f75f7e4 100644 --- a/.github/workflows/repackage-release-artifacts.yml +++ b/.github/workflows/repackage-release-artifacts.yml @@ -22,8 +22,8 @@ on: required: true jobs: - RepackageReleaseArtifcats: - name: 'RepackageReleaseArtifcats' + RepackageS3Artifcats: + name: 'RepackageS3Artifcats' runs-on: ubuntu-latest strategy: fail-fast: false @@ -126,8 +126,8 @@ jobs: aws --region us-gov-east-1 s3 cp --no-progress ./amazon-cloudwatch-agent.deb s3://${{ env.S3_INTEGRATION_BUCKET_ITAR }}/integration-test/binary/${{ inputs.build_id }}/linux/arm64/amazon-cloudwatch-agent.deb popd - RepackageUploadImage: - name: 'RepackageUploadImage' + RepackageECRImage: + name: 'RepackageECRImage' runs-on: ubuntu-latest strategy: fail-fast: false @@ -163,7 +163,7 @@ jobs: id: push-image env: ARTIFACTS_REGISTRY: ${{ steps.login-artifacts-ecr.outputs.registry }} - INTEG_TEST_REGISTRY: ${{ steps.login-artifacts-ecr.outputs.registry }} + INTEG_TEST_REGISTRY: ${{ steps.login-integ-test-ecr.outputs.registry }} run: | docker tag ${{ env.ARTIFACTS_REGISTRY }}/cloudwatch-agent:${{ inputs.build_id }} ${{ env.INTEG_TEST_REGISTRY }}/cwagent-integration-test:${{ inputs.build_id }} docker push ${{ env.INTEG_TEST_REGISTRY }}/cwagent-integration-test:${{ inputs.build_id }} From 08062417ef56af0a3abc6be913a82038e66cf86a Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Mon, 10 Feb 2025 12:20:30 -0500 Subject: [PATCH 38/39] call test-artifacts --- .github/workflows/release-candidate-test.yml | 20 +- .github/workflows/test-artifacts.yml | 305 +++++++++---------- 2 files changed, 164 insertions(+), 161 deletions(-) diff --git a/.github/workflows/release-candidate-test.yml b/.github/workflows/release-candidate-test.yml index b59d4342a3..89bc022684 100644 --- a/.github/workflows/release-candidate-test.yml +++ b/.github/workflows/release-candidate-test.yml @@ -8,6 +8,7 @@ env: S3_INTEGRATION_BUCKET: ${{ vars.S3_INTEGRATION_BUCKET }} S3_RELEASE_BUCKET: amazon-cloud-watch-agent S3_RELEASE_REPO: cloudwatch-agent + CWA_GITHUB_TEST_REPO_BRANCH: "main" TERRAFORM_AWS_ASSUME_ROLE_ITAR: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }} S3_INTEGRATION_BUCKET_ITAR: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} TERRAFORM_AWS_ASSUME_ROLE_CN: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} @@ -25,6 +26,21 @@ on: type: string jobs: + OutputEnvVariables: + name: 'OutputEnvVariables' + runs-on: ubuntu-latest + outputs: + CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + steps: + - name: SetOutputs + id: set-outputs + run: | + echo "CWA_GITHUB_TEST_REPO_BRANCH=${CWA_GITHUB_TEST_REPO_BRANCH:-${{ env.CWA_GITHUB_TEST_REPO_BRANCH }}}" >> "$GITHUB_OUTPUT" + + - name: Echo test variables + run: | + echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" + RepackageArtifacts: name: 'RepackageArtifacts' uses: ./.github/workflows/repackage-release-artifacts.yml @@ -36,10 +52,10 @@ jobs: build_id: ${{ inputs.build_id }} StartIntegrationTests: - needs: [ RepackageArtifacts ] + needs: [ RepackageArtifacts, OutputEnvVariables ] runs-on: ubuntu-latest steps: # Avoid the limit of 5 nested workflows by executing the workflow in this manner - - run: gh workflow run test-artifacts.yml --ref ${{ github.ref_name }} --repo $GITHUB_REPOSITORY -f build_id=${{ inputs.build_id }} -f ecr_rest_repo=${{ env.S3_RELEASE_REPO }} + - run: gh workflow run test-artifacts.yml --ref ${{ github.ref_name }} --repo $GITHUB_REPOSITORY -f build_id=${{ inputs.build_id }} -f test_repo_branch=${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index 8004e9b038..0d2deb9196 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -26,12 +26,6 @@ on: description: 'The build ID (release candidate build number or GitHub commit SHA)' type: string required: true - ecr_registry: - description: 'Override for the ECR repository which holds the agent image' - type: string - ecr_repo: - description: 'Override for the ECR repository which holds the agent image (default is cwagent-integration-test)' - type: string test_repo_branch: description: 'Override for the GitHub test repository branch to use (default is main)' type: string @@ -53,20 +47,16 @@ jobs: id: set-outputs run: | CWA_GITHUB_TEST_REPO_BRANCH=${{ inputs.test_repo_branch }} - ECR_REPO=${{ inputs.ecr_repo }} - ECR_REGISTRY=${{ inputs.ecr_registry }} echo "CWA_GITHUB_TEST_REPO_NAME=${{ env.CWA_GITHUB_TEST_REPO_NAME }}" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_URL=${{ env.CWA_GITHUB_TEST_REPO_URL }}" >> "$GITHUB_OUTPUT" echo "CWA_GITHUB_TEST_REPO_BRANCH=${CWA_GITHUB_TEST_REPO_BRANCH:-${{ env.CWA_GITHUB_TEST_REPO_BRANCH }}}" >> "$GITHUB_OUTPUT" - echo "ARTIFACTS_ECR_REPO=${ARTIFACTS_ECR_REPO:-${{ env.ECR_INTEGRATION_TEST_REPO }}}" >> "$GITHUB_OUTPUT" - name: Echo test variables run: | echo "CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}" echo "CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}" echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" - echo "ARTIFACTS_ECR_REPO: ${{ steps.set-outputs.outputs.ARTIFACTS_ECR_REPO }}" - uses: actions/checkout@v3 with: @@ -370,7 +360,7 @@ jobs: name: 'EC2LinuxITAR' uses: ./.github/workflows/ec2-integration-test.yml with: - github_sha: ${{inputs.build_id}} + build_id: ${{ inputs.build_id }} test_dir: terraform/ec2/linux job_id: ec2-linux-integration-test test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_itar_matrix}} @@ -388,7 +378,7 @@ jobs: name: 'EC2LinuxCN' uses: ./.github/workflows/ec2-integration-test.yml with: - github_sha: ${{inputs.build_id}} + build_id: ${{ inputs.build_id }} test_dir: terraform/ec2/linux job_id: ec2-linux-integration-test test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_china_matrix}} @@ -407,7 +397,7 @@ jobs: name: 'OnpremLinux' uses: ./.github/workflows/ec2-integration-test.yml with: - github_sha: ${{inputs.build_id}} + build_id: ${{ inputs.build_id }} test_dir: terraform/ec2/linux_onprem job_id: linux-onprem-integration-test test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_onprem_matrix}} @@ -416,165 +406,162 @@ jobs: test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} region: us-west-2 - agent_s3_path_linux: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_LINUX }} - agent_s3_path_windows: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_WINDOWS }} - agent_s3_path_mac: ${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }} secrets: inherit - # EC2WinIntegrationTest: - # needs: [OutputEnvVariables, GenerateTestMatrix] - # name: 'EC2WinIntegrationTest' - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + EC2WinIntegrationTest: + needs: [OutputEnvVariables, GenerateTestMatrix] + name: 'EC2WinIntegrationTest' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_matrix) }} + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + with: + repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - # - name: Echo Test Info - # run: echo run on ec2 instance os ${{ matrix.arrays.os }} use ssm ${{ matrix.arrays.useSSM }} test ${{ matrix.arrays.test_dir }} + - name: Echo Test Info + run: echo run on ec2 instance os ${{ matrix.arrays.os }} use ssm ${{ matrix.arrays.useSSM }} test ${{ matrix.arrays.test_dir }} - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 - # - name: Verify Terraform version - # run: terraform --version + - name: Verify Terraform version + run: terraform --version - # # nick-fields/retry@v2 starts at base dir - # - name: Terraform apply - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 30 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ec2/win - # fi - # terraform init - # if terraform apply --auto-approve \ - # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="ssh_key_value=${PRIVATE_KEY}" \ - # -var="ssh_key_name=${KEY_NAME}" \ - # -var="test_name=${{ matrix.arrays.os }}" \ - # -var="cwa_github_sha= ${{ inputs.build_id }}" \ - # -var="test_dir=${{ matrix.arrays.test_dir }}" \ - # -var="ami=${{ matrix.arrays.ami }}" \ - # -var="use_ssm=${{ matrix.arrays.useSSM }}" \ - # -var="s3_bucket=${{ vars.S3_INTEGRATION_BUCKET }}" \ - # terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi + # nick-fields/retry@v2 starts at base dir + - name: Terraform apply + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/ec2/win + fi + terraform init + if terraform apply --auto-approve \ + -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + -var="ssh_key_value=${PRIVATE_KEY}" \ + -var="ssh_key_name=${KEY_NAME}" \ + -var="test_name=${{ matrix.arrays.os }}" \ + -var="cwa_github_sha= ${{ inputs.build_id }}" \ + -var="test_dir=${{ matrix.arrays.test_dir }}" \ + -var="ami=${{ matrix.arrays.ami }}" \ + -var="use_ssm=${{ matrix.arrays.useSSM }}" \ + -var="s3_bucket=${{ vars.S3_INTEGRATION_BUCKET }}" \ + terraform destroy -auto-approve + else + terraform destroy -auto-approve && exit 1 + fi - # #This is here just in case workflow cancel - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ec2/win - # fi - # terraform destroy --auto-approve + #This is here just in case workflow cancel + - name: Terraform destroy + if: ${{ cancelled() || failure() }} + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 8 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/ec2/win + fi + terraform destroy --auto-approve - # EC2DarwinIntegrationTest: - # needs: [GenerateTestMatrix, OutputEnvVariables] - # name: 'EC2DarwinIntegrationTest' - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_mac_matrix) }} - # permissions: - # id-token: write - # contents: read - # steps: - # - uses: actions/checkout@v3 - # with: - # repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - # ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + EC2DarwinIntegrationTest: + needs: [GenerateTestMatrix, OutputEnvVariables] + name: 'EC2DarwinIntegrationTest' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_mac_matrix) }} + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v3 + with: + repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - # - name: Configure AWS Credentials - # uses: aws-actions/configure-aws-credentials@v2 - # with: - # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - # aws-region: us-west-2 - # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - # - name: Echo OS - # run: echo run on ec2 instance os ${{ matrix.arrays.os }} + - name: Echo OS + run: echo run on ec2 instance os ${{ matrix.arrays.os }} - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 - # - name: Verify Terraform version - # run: terraform --version + - name: Verify Terraform version + run: terraform --version - # # nick-fields/retry@v2 starts at base dir - # - name: Terraform apply - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 60 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ec2/mac - # fi - # terraform init - # if terraform apply --auto-approve \ - # -var="ssh_key_value=${PRIVATE_KEY}" -var="ssh_key_name=${KEY_NAME}" \ - # -var="arc=${{ matrix.arrays.arc }}" \ - # -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - # -var="cwa_github_sha=${GITHUB_SHA}" -var="ami=${{ matrix.arrays.ami }}" \ - # -var="test_dir=${{ matrix.arrays.test_dir }}" \ - # -var="license_manager_arn=${{ env.LICENSE_MANAGER_ARN }}" \ - # -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ - # -var="agent_s3_path_mac=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }}; then - # terraform destroy -auto-approve - # else - # terraform destroy -auto-approve && exit 1 - # fi + # nick-fields/retry@v2 starts at base dir + - name: Terraform apply + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 60 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/ec2/mac + fi + terraform init + if terraform apply --auto-approve \ + -var="ssh_key_value=${PRIVATE_KEY}" -var="ssh_key_name=${KEY_NAME}" \ + -var="arc=${{ matrix.arrays.arc }}" \ + -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + -var="cwa_github_sha=${GITHUB_SHA}" -var="ami=${{ matrix.arrays.ami }}" \ + -var="test_dir=${{ matrix.arrays.test_dir }}" \ + -var="license_manager_arn=${{ env.LICENSE_MANAGER_ARN }}" \ + -var="s3_bucket=${S3_INTEGRATION_BUCKET}" \ + -var="agent_s3_path_mac=${{ needs.OutputEnvVariables.outputs.AGENT_S3_PATH_MAC }}; then + terraform destroy -auto-approve + else + terraform destroy -auto-approve && exit 1 + fi - # #This is here just in case workflow cancel - # - name: Terraform destroy - # if: ${{ cancelled() || failure() }} - # uses: nick-fields/retry@v2 - # with: - # max_attempts: 3 - # timeout_minutes: 8 - # retry_wait_seconds: 5 - # command: | - # if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - # cd "${{ matrix.arrays.terraform_dir }}" - # else - # cd terraform/ec2/mac - # fi - # terraform destroy --auto-approve + #This is here just in case workflow cancel + - name: Terraform destroy + if: ${{ cancelled() || failure() }} + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 8 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/ec2/mac + fi + terraform destroy --auto-approve StopLocalStack: name: 'StopLocalStack' @@ -655,7 +642,7 @@ jobs: id: login-ecr uses: aws-actions/amazon-ecr-login@v2 with: - registries: ${{ vars.RELEASE_ARTIFACTS_ACCOUNT_ID }} + registries: ${{ secrets.RELEASE_ARTIFACTS_ACCOUNT_ID }} - name: Install Terraform uses: hashicorp/setup-terraform@v3 @@ -680,7 +667,7 @@ jobs: if terraform apply --auto-approve\ -var="test_dir=${{ matrix.arrays.test_dir }}"\ -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ needs.OutputEnvVariables.outputs.ARTIFACTS_ECR_REPO }}"\ + -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ -var="cwagent_image_tag=${{ inputs.build_id }}"\ -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ -var="metadataEnabled=${{ matrix.arrays.metadataEnabled }}" \ From 5b9e76d27998198f9c9cf938a052568dd8817743 Mon Sep 17 00:00:00 2001 From: Rick Rossi Date: Mon, 10 Feb 2025 12:23:20 -0500 Subject: [PATCH 39/39] dummy commit to create the workflow --- .github/workflows/test-artifacts.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index 0d2deb9196..c59192d97b 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -29,6 +29,7 @@ on: test_repo_branch: description: 'Override for the GitHub test repository branch to use (default is main)' type: string + pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref_name }}