From 578e284995d9207105d45914ac95f40c54d1324e Mon Sep 17 00:00:00 2001 From: Hyunsoo Kim Date: Wed, 10 Dec 2025 16:42:09 +0000 Subject: [PATCH 1/7] onprem only --- .github/workflows/test-artifacts.yml | 2286 +++++++++++++------------- 1 file changed, 1153 insertions(+), 1133 deletions(-) diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index 98cfd3d649..284b0abceb 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -13,7 +13,7 @@ env: 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" + CWA_GITHUB_TEST_REPO_BRANCH: "hsookim/test-only" 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 }} @@ -71,7 +71,7 @@ jobs: - name: Checkout agent repository for commit date uses: actions/checkout@v3 with: - repository: aws/amazon-cloudwatch-agent + repository: aws/amazon-cloudwatch-agent` fetch-depth: 0 path: agent-repo @@ -196,38 +196,38 @@ jobs: 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: ${{ 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@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: Test cf - run: | - cd test/test/cloudformation - 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 + # 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@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: Test cf + # run: | + # cd test/test/cloudformation + # 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' @@ -246,247 +246,206 @@ 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: - AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_ITAR }} - KEY_NAME: ${{ secrets.KEY_NAME }} - 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, UploadDependenciesCN ] - uses: ./.github/workflows/start-localstack.yml - secrets: - AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_CN }} - KEY_NAME: ${{ secrets.KEY_NAME }} - 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 }} - - UploadDependenciesCN: - name: 'UploadDependenciesCN' - needs: [ OutputEnvVariables ] - uses: ./.github/workflows/upload-dependencies.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 }} - github_sha: ${{github.sha}} - s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} - terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} - - EC2NvidiaGPUIntegrationTest: - needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] - name: ${{matrix.arrays.testName}} - 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@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: 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 - with: - terraform_version: 1.12.0 - - - 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=${{ inputs.build_id }}" \ - -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ - -var="github_test_repo_branch=${{ needs.OutputEnvVariables.outputs.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=${{ inputs.build_id }}" \ - -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=${{ needs.OutputEnvVariables.outputs.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 }} - is_selinux_test: false - secrets: inherit - - - EC2LinuxIntegrationTestITAR: - needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] - name: 'EC2LinuxITAR' + # StartLocalStackITAR: + # name: 'StartLocalStackITAR' + # needs: [OutputEnvVariables] + # uses: ./.github/workflows/start-localstack.yml + # secrets: + # AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_ITAR }} + # KEY_NAME: ${{ secrets.KEY_NAME }} + # 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, UploadDependenciesCN ] + # uses: ./.github/workflows/start-localstack.yml + # secrets: + # AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_CN }} + # KEY_NAME: ${{ secrets.KEY_NAME }} + # 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 }} + + # UploadDependenciesCN: + # name: 'UploadDependenciesCN' + # needs: [ OutputEnvVariables ] + # uses: ./.github/workflows/upload-dependencies.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 }} + # github_sha: ${{github.sha}} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + + # EC2NvidiaGPUIntegrationTest: + # needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + # name: ${{matrix.arrays.testName}} + # 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@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: 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 + # with: + # terraform_version: 1.12.0 + + # - 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=${{ inputs.build_id }}" \ + # -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ + # -var="github_test_repo_branch=${{ needs.OutputEnvVariables.outputs.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=${{ inputs.build_id }}" \ + # -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=${{ needs.OutputEnvVariables.outputs.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 }} + # is_selinux_test: false + # secrets: inherit + + LinuxOnPremIntegrationTest: + needs: [StartLocalStack, GenerateTestMatrix, OutputEnvVariables] + name: 'OnpremLinux' 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_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: - AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_ITAR }} - KEY_NAME: ${{ secrets.KEY_NAME }} - - EC2LinuxIntegrationTestCN: - needs: [ StartLocalStackCN, GenerateTestMatrix, OutputEnvVariables ] - name: 'EC2LinuxCN' - 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_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: - AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_CN }} - KEY_NAME: ${{ secrets.KEY_NAME }} - - EC2SELinuxIntegrationTest: - needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] - name: 'EC2SELinux' - 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_selinux_matrix}} + 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 }} @@ -494,171 +453,232 @@ jobs: region: us-west-2 terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} - is_selinux_test: true - - EC2WinIntegrationTest: - needs: [OutputEnvVariables, GenerateTestMatrix] - name: ${{matrix.arrays.testName}} - 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@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: 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 - with: - terraform_version: 1.12.0 - - - 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/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=${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, OutputEnvVariables] - name: ${{matrix.arrays.testName}} - 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@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: Echo OS - run: echo run on ec2 instance os ${{ matrix.arrays.os }} - - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: 1.12.0 + is_selinux_test: false + secrets: inherit - - 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=${{ inputs.build_id }}" \ - -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 + # EC2LinuxIntegrationTestITAR: + # needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] + # name: 'EC2LinuxITAR' + # 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_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: + # AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_ITAR }} + # KEY_NAME: ${{ secrets.KEY_NAME }} + + # EC2LinuxIntegrationTestCN: + # needs: [ StartLocalStackCN, GenerateTestMatrix, OutputEnvVariables ] + # name: 'EC2LinuxCN' + # 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_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: + # AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_CN }} + # KEY_NAME: ${{ secrets.KEY_NAME }} + + # EC2SELinuxIntegrationTest: + # needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + # name: 'EC2SELinux' + # 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_selinux_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 }} + # is_selinux_test: true + + # EC2WinIntegrationTest: + # needs: [OutputEnvVariables, GenerateTestMatrix] + # name: ${{matrix.arrays.testName}} + # 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@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: 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 + # with: + # terraform_version: 1.12.0 + + # - 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/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=${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, OutputEnvVariables] + # name: ${{matrix.arrays.testName}} + # 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@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: Echo OS + # run: echo run on ec2 instance os ${{ matrix.arrays.os }} + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + # with: + # terraform_version: 1.12.0 + + # - 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=${{ inputs.build_id }}" \ + # -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, OutputEnvVariables ] + # needs: [ StartLocalStack, EC2LinuxIntegrationTest, LinuxOnPremIntegrationTest, OutputEnvVariables ] + needs: [ StartLocalStack, LinuxOnPremIntegrationTest, OutputEnvVariables ] uses: ./.github/workflows/stop-localstack.yml secrets: inherit permissions: @@ -672,705 +692,705 @@ 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: - AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_ITAR }} - KEY_NAME: ${{ secrets.KEY_NAME }} - 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, OutputEnvVariables] - uses: ./.github/workflows/stop-localstack.yml - secrets: - AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_CN }} - KEY_NAME: ${{ secrets.KEY_NAME }} - 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: ${{matrix.arrays.testName}} - 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: 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 ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v2 - - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: 1.12.0 - - - name: Verify Terraform version - run: terraform --version - - - 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/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=${{ 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: ${{matrix.arrays.testName}} - 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@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 ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v2 - - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: 1.12.0 - - - name: Verify Terraform version - run: terraform --version - - - 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/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=${{ inputs.build_id }}"; 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: ${{matrix.arrays.testName}} - 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@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 ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v2 - - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: 1.12.0 - - - 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=${{ inputs.build_id }}" \ - -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: ${{matrix.arrays.testName}} - 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@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 ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v2 - - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: 1.12.0 - - - 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=${{ inputs.build_id }}" \ - -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/deployment - fi - terraform destroy --auto-approve - - PerformanceTrackingTest: - name: ${{matrix.arrays.testName}} - 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@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: Install Terraform - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: 1.12.0 - - - 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=${{ inputs.build_id }}" \ - -var="cwa_github_sha_date=${{ needs.OutputEnvVariables.outputs.CWA_COMMIT_DATE }}" \ - -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: ${{matrix.arrays.testName}} - needs: [ GenerateTestMatrix, OutputEnvVariables ] - 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: ${{ 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@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: Install Terraform - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: 1.12.0 - - - 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=${{ inputs.build_id }}" \ - -var="cwa_github_sha_date=${{ needs.OutputEnvVariables.outputs.CWA_COMMIT_DATE }}" \ - -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: ${{matrix.arrays.testName}} - needs: [GenerateTestMatrix, OutputEnvVariables ] - 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: ${{ 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@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: Install Terraform - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: 1.12.0 - - - 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=${{ inputs.build_id }}" \ - -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: ${{matrix.arrays.testName}} - needs: [GenerateTestMatrix, OutputEnvVariables] - 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: ${{ 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@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: Install Terraform - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: 1.12.0 - - - 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=${{ inputs.build_id }}" \ - -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: ${{matrix.arrays.testName}} - 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: ${{ 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@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: Install Terraform - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: 1.12.0 - - - 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 }}:${{ 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 + # StopLocalStackITAR: + # name: 'StopLocalStackITAR' + # if: ${{ always() && needs.StartLocalStackITAR.result == 'success' }} + # needs: [ StartLocalStackITAR, EC2LinuxIntegrationTestITAR, OutputEnvVariables ] + # uses: ./.github/workflows/stop-localstack.yml + # secrets: + # AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_ITAR }} + # KEY_NAME: ${{ secrets.KEY_NAME }} + # 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, OutputEnvVariables] + # uses: ./.github/workflows/stop-localstack.yml + # secrets: + # AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_CN }} + # KEY_NAME: ${{ secrets.KEY_NAME }} + # 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: ${{matrix.arrays.testName}} + # 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: 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 ECR + # id: login-ecr + # uses: aws-actions/amazon-ecr-login@v2 + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + # with: + # terraform_version: 1.12.0 + + # - name: Verify Terraform version + # run: terraform --version + + # - 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/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=${{ 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: ${{matrix.arrays.testName}} + # 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@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 ECR + # id: login-ecr + # uses: aws-actions/amazon-ecr-login@v2 + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + # with: + # terraform_version: 1.12.0 + + # - name: Verify Terraform version + # run: terraform --version + + # - 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/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=${{ inputs.build_id }}"; 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: ${{matrix.arrays.testName}} + # 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@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 ECR + # id: login-ecr + # uses: aws-actions/amazon-ecr-login@v2 + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + # with: + # terraform_version: 1.12.0 + + # - 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=${{ inputs.build_id }}" \ + # -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: ${{matrix.arrays.testName}} + # 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@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 ECR + # id: login-ecr + # uses: aws-actions/amazon-ecr-login@v2 + + # - name: Install Terraform + # uses: hashicorp/setup-terraform@v3 + # with: + # terraform_version: 1.12.0 + + # - 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=${{ inputs.build_id }}" \ + # -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/deployment + # fi + # terraform destroy --auto-approve + + # PerformanceTrackingTest: + # name: ${{matrix.arrays.testName}} + # 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@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: Install Terraform + # uses: hashicorp/setup-terraform@v3 + # with: + # terraform_version: 1.12.0 + + # - 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=${{ inputs.build_id }}" \ + # -var="cwa_github_sha_date=${{ needs.OutputEnvVariables.outputs.CWA_COMMIT_DATE }}" \ + # -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: ${{matrix.arrays.testName}} + # needs: [ GenerateTestMatrix, OutputEnvVariables ] + # 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: ${{ 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@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: Install Terraform + # uses: hashicorp/setup-terraform@v3 + # with: + # terraform_version: 1.12.0 + + # - 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=${{ inputs.build_id }}" \ + # -var="cwa_github_sha_date=${{ needs.OutputEnvVariables.outputs.CWA_COMMIT_DATE }}" \ + # -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: ${{matrix.arrays.testName}} + # needs: [GenerateTestMatrix, OutputEnvVariables ] + # 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: ${{ 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@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: Install Terraform + # uses: hashicorp/setup-terraform@v3 + # with: + # terraform_version: 1.12.0 + + # - 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=${{ inputs.build_id }}" \ + # -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: ${{matrix.arrays.testName}} + # needs: [GenerateTestMatrix, OutputEnvVariables] + # 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: ${{ 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@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: Install Terraform + # uses: hashicorp/setup-terraform@v3 + # with: + # terraform_version: 1.12.0 + + # - 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=${{ inputs.build_id }}" \ + # -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: ${{matrix.arrays.testName}} + # 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: ${{ 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@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: Install Terraform + # uses: hashicorp/setup-terraform@v3 + # with: + # terraform_version: 1.12.0 + + # - 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 }}:${{ 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 From c64ea368730b22007a2efb42f2502be5f56528a9 Mon Sep 17 00:00:00 2001 From: Hyunsoo Kim Date: Wed, 10 Dec 2025 16:53:34 +0000 Subject: [PATCH 2/7] typo --- .github/workflows/test-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index 284b0abceb..9645e28359 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -71,7 +71,7 @@ jobs: - name: Checkout agent repository for commit date uses: actions/checkout@v3 with: - repository: aws/amazon-cloudwatch-agent` + repository: aws/amazon-cloudwatch-agent fetch-depth: 0 path: agent-repo From 0addc3bdc34cacddb37a401fdff462948f2fb766 Mon Sep 17 00:00:00 2001 From: Hyunsoo Kim Date: Wed, 10 Dec 2025 19:01:35 +0000 Subject: [PATCH 3/7] add onprem matrix --- .github/workflows/test-artifacts.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index 9645e28359..276660fcb8 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -131,6 +131,7 @@ jobs: outputs: ec2_gpu_matrix: ${{ steps.set-matrix.outputs.ec2_gpu_matrix }} ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_matrix }} + ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_onprem_matrix }} ec2_selinux_matrix: ${{ steps.set-matrix.outputs.ec2_selinux_matrix }} ec2_windows_matrix: ${{ steps.set-matrix.outputs.ec2_windows_matrix }} ec2_mac_matrix: ${{ steps.set-matrix.outputs.ec2_mac_matrix }} @@ -163,6 +164,7 @@ jobs: 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_linux_onprem_matrix=$(echo $(cat generator/resources/ec2_linux_onprem_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" echo "ec2_selinux_matrix=$(echo $(cat generator/resources/ec2_selinux_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" @@ -182,6 +184,7 @@ jobs: 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_linux_onprem_matrix: ${{ steps.set-matrix.outputs.ec2_linux_onprem_matrix }}" echo "ec2_selinux_matrix: ${{ steps.set-matrix.outputs.ec2_selinux_matrix }}" echo "ec2_windows_matrix: ${{ steps.set-matrix.outputs.ec2_windows_matrix }}" echo "ec2_mac_matrix: ${{ steps.set-matrix.outputs.ec2_mac_matrix }}" From 91ec7b0abccbabd84c448479da3f9f332e3abd9a Mon Sep 17 00:00:00 2001 From: Hyunsoo Kim Date: Wed, 10 Dec 2025 19:52:53 +0000 Subject: [PATCH 4/7] typo --- .github/workflows/test-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index 276660fcb8..b776808e7f 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -131,7 +131,7 @@ jobs: outputs: ec2_gpu_matrix: ${{ steps.set-matrix.outputs.ec2_gpu_matrix }} ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_matrix }} - ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_onprem_matrix }} + ec2_linux_onprem_matrix: ${{ steps.set-matrix.outputs.ec2_linux_onprem_matrix }} ec2_selinux_matrix: ${{ steps.set-matrix.outputs.ec2_selinux_matrix }} ec2_windows_matrix: ${{ steps.set-matrix.outputs.ec2_windows_matrix }} ec2_mac_matrix: ${{ steps.set-matrix.outputs.ec2_mac_matrix }} From f59f50e0d20772e9652193d163ee4fb81ce15b60 Mon Sep 17 00:00:00 2001 From: Hyunsoo Kim Date: Fri, 12 Dec 2025 01:53:50 +0000 Subject: [PATCH 5/7] more comment --- .github/workflows/test-artifacts.yml | 67 ++++++++++++++-------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index b776808e7f..7136496f5b 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -232,22 +232,22 @@ jobs: # cd test/test/cloudformation # 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' - 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: ${{ inputs.build_id }} - 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: ${{ inputs.build_id }} + # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} # StartLocalStackITAR: # name: 'StartLocalStackITAR' @@ -441,7 +441,7 @@ jobs: # secrets: inherit LinuxOnPremIntegrationTest: - needs: [StartLocalStack, GenerateTestMatrix, OutputEnvVariables] + needs: [GenerateTestMatrix, OutputEnvVariables] name: 'OnpremLinux' uses: ./.github/workflows/ec2-integration-test.yml with: @@ -677,23 +677,22 @@ jobs: # fi # terraform destroy --auto-approve - StopLocalStack: - name: 'StopLocalStack' - if: ${{ always() && needs.StartLocalStack.result == 'success' }} - # needs: [ StartLocalStack, EC2LinuxIntegrationTest, LinuxOnPremIntegrationTest, OutputEnvVariables ] - needs: [ StartLocalStack, 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: ${{inputs.build_id}} - 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' From b4070a554dc5b3dbed4bad0a021fecda90c6a2ed Mon Sep 17 00:00:00 2001 From: Hyunsoo Kim Date: Fri, 12 Dec 2025 20:06:13 +0000 Subject: [PATCH 6/7] add onprem flag --- .github/workflows/ec2-integration-test.yml | 3 + .github/workflows/test-artifacts.yml | 104 +++++++++++---------- 2 files changed, 56 insertions(+), 51 deletions(-) diff --git a/.github/workflows/ec2-integration-test.yml b/.github/workflows/ec2-integration-test.yml index c80817e554..8ddd9c1530 100644 --- a/.github/workflows/ec2-integration-test.yml +++ b/.github/workflows/ec2-integration-test.yml @@ -40,6 +40,8 @@ on: type: string is_selinux_test: type: boolean + is_onprem_test: + type: boolean s3_integration_bucket: type: string secrets: @@ -123,6 +125,7 @@ jobs: -var="ssh_key_value=${{env.PRIVATE_KEY}}" \ -var="test_dir=${{ matrix.arrays.test_dir }}" \ -var="test_name=${{ matrix.arrays.os }}" \ + -var="is_onprem=${{ inputs.is_onprem_test }}" \ -var="user=${{ matrix.arrays.username }}"; then terraform destroy -var="region=${{ inputs.region }}" -var="ami=${{ matrix.arrays.ami }}" -auto-approve else diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index 7136496f5b..4d8f438771 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -232,22 +232,22 @@ jobs: # cd test/test/cloudformation # 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' - # 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: ${{ inputs.build_id }} - # 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: ${{ inputs.build_id }} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} # StartLocalStackITAR: # name: 'StartLocalStackITAR' @@ -421,24 +421,25 @@ jobs: # 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 }} - # is_selinux_test: false - # secrets: inherit + 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 }} + is_selinux_test: false + is_onprem_test: false + secrets: inherit LinuxOnPremIntegrationTest: needs: [GenerateTestMatrix, OutputEnvVariables] @@ -446,7 +447,7 @@ jobs: uses: ./.github/workflows/ec2-integration-test.yml with: build_id: ${{ inputs.build_id }} - test_dir: terraform/ec2/linux_onprem + test_dir: terraform/ec2/linux 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 }} @@ -457,6 +458,7 @@ jobs: terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }} s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET }} is_selinux_test: false + is_onprem_test: true secrets: inherit @@ -677,22 +679,22 @@ jobs: # fi # terraform destroy --auto-approve - # 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 }} + 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' From 8edd41bbbf7548249c07f1756a37ce1dde64e886 Mon Sep 17 00:00:00 2001 From: Hyunsoo Kim Date: Fri, 12 Dec 2025 20:53:31 +0000 Subject: [PATCH 7/7] revert comments --- .github/workflows/test-artifacts.yml | 2244 +++++++++++++------------- 1 file changed, 1122 insertions(+), 1122 deletions(-) diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index 4d8f438771..87c5807769 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -13,7 +13,7 @@ env: 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: "hsookim/test-only" + 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 }} @@ -199,38 +199,38 @@ jobs: 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: ${{ 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@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: Test cf - # run: | - # cd test/test/cloudformation - # 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 + 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@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: Test cf + run: | + cd test/test/cloudformation + 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' @@ -249,177 +249,177 @@ 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: - # AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_ITAR }} - # KEY_NAME: ${{ secrets.KEY_NAME }} - # 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, UploadDependenciesCN ] - # uses: ./.github/workflows/start-localstack.yml - # secrets: - # AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_CN }} - # KEY_NAME: ${{ secrets.KEY_NAME }} - # 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 }} - - # UploadDependenciesCN: - # name: 'UploadDependenciesCN' - # needs: [ OutputEnvVariables ] - # uses: ./.github/workflows/upload-dependencies.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 }} - # github_sha: ${{github.sha}} - # s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} - # terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} - - # EC2NvidiaGPUIntegrationTest: - # needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] - # name: ${{matrix.arrays.testName}} - # 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@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: 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 - # with: - # terraform_version: 1.12.0 - - # - 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=${{ inputs.build_id }}" \ - # -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ - # -var="github_test_repo_branch=${{ needs.OutputEnvVariables.outputs.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=${{ inputs.build_id }}" \ - # -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=${{ needs.OutputEnvVariables.outputs.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 + StartLocalStackITAR: + name: 'StartLocalStackITAR' + needs: [OutputEnvVariables] + uses: ./.github/workflows/start-localstack.yml + secrets: + AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_ITAR }} + KEY_NAME: ${{ secrets.KEY_NAME }} + 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, UploadDependenciesCN ] + uses: ./.github/workflows/start-localstack.yml + secrets: + AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_CN }} + KEY_NAME: ${{ secrets.KEY_NAME }} + 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 }} + + UploadDependenciesCN: + name: 'UploadDependenciesCN' + needs: [ OutputEnvVariables ] + uses: ./.github/workflows/upload-dependencies.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 }} + github_sha: ${{github.sha}} + s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} + terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }} + + EC2NvidiaGPUIntegrationTest: + needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + name: ${{matrix.arrays.testName}} + 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@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: 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 + with: + terraform_version: 1.12.0 + + - 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=${{ inputs.build_id }}" \ + -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ + -var="github_test_repo_branch=${{ needs.OutputEnvVariables.outputs.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=${{ inputs.build_id }}" \ + -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=${{ needs.OutputEnvVariables.outputs.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 ] @@ -462,222 +462,222 @@ jobs: secrets: inherit - # EC2LinuxIntegrationTestITAR: - # needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] - # name: 'EC2LinuxITAR' - # 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_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: - # AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_ITAR }} - # KEY_NAME: ${{ secrets.KEY_NAME }} - - # EC2LinuxIntegrationTestCN: - # needs: [ StartLocalStackCN, GenerateTestMatrix, OutputEnvVariables ] - # name: 'EC2LinuxCN' - # 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_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: - # AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_CN }} - # KEY_NAME: ${{ secrets.KEY_NAME }} - - # EC2SELinuxIntegrationTest: - # needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] - # name: 'EC2SELinux' - # 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_selinux_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 }} - # is_selinux_test: true - - # EC2WinIntegrationTest: - # needs: [OutputEnvVariables, GenerateTestMatrix] - # name: ${{matrix.arrays.testName}} - # 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@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: 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 - # with: - # terraform_version: 1.12.0 - - # - 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/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=${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, OutputEnvVariables] - # name: ${{matrix.arrays.testName}} - # 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@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: Echo OS - # run: echo run on ec2 instance os ${{ matrix.arrays.os }} - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - # with: - # terraform_version: 1.12.0 - - # - 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=${{ inputs.build_id }}" \ - # -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 + EC2LinuxIntegrationTestITAR: + needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] + name: 'EC2LinuxITAR' + 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_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: + AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_ITAR }} + KEY_NAME: ${{ secrets.KEY_NAME }} + + EC2LinuxIntegrationTestCN: + needs: [ StartLocalStackCN, GenerateTestMatrix, OutputEnvVariables ] + name: 'EC2LinuxCN' + 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_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: + AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_CN }} + KEY_NAME: ${{ secrets.KEY_NAME }} + + EC2SELinuxIntegrationTest: + needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + name: 'EC2SELinux' + 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_selinux_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 }} + is_selinux_test: true + + EC2WinIntegrationTest: + needs: [OutputEnvVariables, GenerateTestMatrix] + name: ${{matrix.arrays.testName}} + 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@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: 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 + with: + terraform_version: 1.12.0 + + - 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/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=${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, OutputEnvVariables] + name: ${{matrix.arrays.testName}} + 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@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: Echo OS + run: echo run on ec2 instance os ${{ matrix.arrays.os }} + + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: 1.12.0 + + - 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=${{ inputs.build_id }}" \ + -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' @@ -696,705 +696,705 @@ 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: - # AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_ITAR }} - # KEY_NAME: ${{ secrets.KEY_NAME }} - # 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, OutputEnvVariables] - # uses: ./.github/workflows/stop-localstack.yml - # secrets: - # AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_CN }} - # KEY_NAME: ${{ secrets.KEY_NAME }} - # 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: ${{matrix.arrays.testName}} - # 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: 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 ECR - # id: login-ecr - # uses: aws-actions/amazon-ecr-login@v2 - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - # with: - # terraform_version: 1.12.0 - - # - name: Verify Terraform version - # run: terraform --version - - # - 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/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=${{ 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: ${{matrix.arrays.testName}} - # 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@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 ECR - # id: login-ecr - # uses: aws-actions/amazon-ecr-login@v2 - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - # with: - # terraform_version: 1.12.0 - - # - name: Verify Terraform version - # run: terraform --version - - # - 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/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=${{ inputs.build_id }}"; 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: ${{matrix.arrays.testName}} - # 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@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 ECR - # id: login-ecr - # uses: aws-actions/amazon-ecr-login@v2 - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - # with: - # terraform_version: 1.12.0 - - # - 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=${{ inputs.build_id }}" \ - # -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: ${{matrix.arrays.testName}} - # 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@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 ECR - # id: login-ecr - # uses: aws-actions/amazon-ecr-login@v2 - - # - name: Install Terraform - # uses: hashicorp/setup-terraform@v3 - # with: - # terraform_version: 1.12.0 - - # - 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=${{ inputs.build_id }}" \ - # -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/deployment - # fi - # terraform destroy --auto-approve - - # PerformanceTrackingTest: - # name: ${{matrix.arrays.testName}} - # 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@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: Install Terraform - # uses: hashicorp/setup-terraform@v3 - # with: - # terraform_version: 1.12.0 - - # - 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=${{ inputs.build_id }}" \ - # -var="cwa_github_sha_date=${{ needs.OutputEnvVariables.outputs.CWA_COMMIT_DATE }}" \ - # -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: ${{matrix.arrays.testName}} - # needs: [ GenerateTestMatrix, OutputEnvVariables ] - # 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: ${{ 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@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: Install Terraform - # uses: hashicorp/setup-terraform@v3 - # with: - # terraform_version: 1.12.0 - - # - 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=${{ inputs.build_id }}" \ - # -var="cwa_github_sha_date=${{ needs.OutputEnvVariables.outputs.CWA_COMMIT_DATE }}" \ - # -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: ${{matrix.arrays.testName}} - # needs: [GenerateTestMatrix, OutputEnvVariables ] - # 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: ${{ 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@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: Install Terraform - # uses: hashicorp/setup-terraform@v3 - # with: - # terraform_version: 1.12.0 - - # - 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=${{ inputs.build_id }}" \ - # -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: ${{matrix.arrays.testName}} - # needs: [GenerateTestMatrix, OutputEnvVariables] - # 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: ${{ 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@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: Install Terraform - # uses: hashicorp/setup-terraform@v3 - # with: - # terraform_version: 1.12.0 - - # - 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=${{ inputs.build_id }}" \ - # -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: ${{matrix.arrays.testName}} - # 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: ${{ 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@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: Install Terraform - # uses: hashicorp/setup-terraform@v3 - # with: - # terraform_version: 1.12.0 - - # - 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 }}:${{ 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 + StopLocalStackITAR: + name: 'StopLocalStackITAR' + if: ${{ always() && needs.StartLocalStackITAR.result == 'success' }} + needs: [ StartLocalStackITAR, EC2LinuxIntegrationTestITAR, OutputEnvVariables ] + uses: ./.github/workflows/stop-localstack.yml + secrets: + AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_ITAR }} + KEY_NAME: ${{ secrets.KEY_NAME }} + 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, OutputEnvVariables] + uses: ./.github/workflows/stop-localstack.yml + secrets: + AWS_PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY_CN }} + KEY_NAME: ${{ secrets.KEY_NAME }} + 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: ${{matrix.arrays.testName}} + 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: 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 ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: 1.12.0 + + - name: Verify Terraform version + run: terraform --version + + - 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/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=${{ 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: ${{matrix.arrays.testName}} + 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@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 ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: 1.12.0 + + - name: Verify Terraform version + run: terraform --version + + - 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/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=${{ inputs.build_id }}"; 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: ${{matrix.arrays.testName}} + 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@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 ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: 1.12.0 + + - 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=${{ inputs.build_id }}" \ + -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: ${{matrix.arrays.testName}} + 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@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 ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: 1.12.0 + + - 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=${{ inputs.build_id }}" \ + -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/deployment + fi + terraform destroy --auto-approve + + PerformanceTrackingTest: + name: ${{matrix.arrays.testName}} + 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@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: Install Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: 1.12.0 + + - 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=${{ inputs.build_id }}" \ + -var="cwa_github_sha_date=${{ needs.OutputEnvVariables.outputs.CWA_COMMIT_DATE }}" \ + -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: ${{matrix.arrays.testName}} + needs: [ GenerateTestMatrix, OutputEnvVariables ] + 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: ${{ 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@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: Install Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: 1.12.0 + + - 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=${{ inputs.build_id }}" \ + -var="cwa_github_sha_date=${{ needs.OutputEnvVariables.outputs.CWA_COMMIT_DATE }}" \ + -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: ${{matrix.arrays.testName}} + needs: [GenerateTestMatrix, OutputEnvVariables ] + 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: ${{ 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@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: Install Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: 1.12.0 + + - 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=${{ inputs.build_id }}" \ + -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: ${{matrix.arrays.testName}} + needs: [GenerateTestMatrix, OutputEnvVariables] + 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: ${{ 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@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: Install Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: 1.12.0 + + - 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=${{ inputs.build_id }}" \ + -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: ${{matrix.arrays.testName}} + 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: ${{ 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@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: Install Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: 1.12.0 + + - 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 }}:${{ 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