From 59259f55f025d1cb0d7554dfad918b6396e1a532 Mon Sep 17 00:00:00 2001 From: Paramadon Date: Mon, 10 Mar 2025 09:59:08 -0400 Subject: [PATCH 1/8] fixing issue --- .github/workflows/deploy-canary.yml | 2 +- .github/workflows/ec2-integration-test.yml | 5 +++++ .github/workflows/integration-test.yml | 2 +- .github/workflows/test-artifacts.yml | 23 +++++++++++++++++++++- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-canary.yml b/.github/workflows/deploy-canary.yml index 93fc8d1555..fa873bca00 100644 --- a/.github/workflows/deploy-canary.yml +++ b/.github/workflows/deploy-canary.yml @@ -9,7 +9,7 @@ env: PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY }} 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: "selinuxTest" on: schedule: diff --git a/.github/workflows/ec2-integration-test.yml b/.github/workflows/ec2-integration-test.yml index 98f48025dc..3df852dfbe 100644 --- a/.github/workflows/ec2-integration-test.yml +++ b/.github/workflows/ec2-integration-test.yml @@ -38,6 +38,8 @@ on: type: string terraform_assume_role: type: string + is_selinux_test: + type: boolean s3_integration_bucket: type: string @@ -103,10 +105,13 @@ jobs: -var="github_test_repo=${{ inputs.test_repo_url }}" \ -var="github_test_repo_branch=${{inputs.test_repo_branch}}" \ -var="install_agent=${{ matrix.arrays.installAgentCommand }}" \ + -var="is_selinux_test=${{ inputs.is_selinux_test }}" \ + -var="selinux_branch=${{ matrix.arrays.selinux_branch }}" \ -var="local_stack_host_name=${{ inputs.localstack_host }}" \ -var="plugin_tests='${{ github.event.inputs.plugins }}'" \ -var="region=${{ inputs.region }}" \ -var="s3_bucket=${{ inputs.s3_integration_bucket }}" \ + -var="selinux_branch=${{ matrix.arrays.selinux_branch }}" \ -var="ssh_key_name=${{env.KEY_NAME}}" \ -var="ssh_key_value=${{env.PRIVATE_KEY}}" \ -var="test_dir=${{ matrix.arrays.test_dir }}" \ diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 37823e93ea..aa2dc3e7f2 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.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: "selinuxTest" 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 }} diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index b8434afcf6..1dee485f74 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: "selinuxTest" 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 }} @@ -85,6 +85,7 @@ jobs: outputs: ec2_gpu_matrix: ${{ steps.set-matrix.outputs.ec2_gpu_matrix }} ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_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 }} ec2_performance_matrix: ${{steps.set-matrix.outputs.ec2_performance_matrix}} @@ -134,6 +135,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_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 }}" echo "ec2_performance_matrix: ${{ steps.set-matrix.outputs.ec2_performance_matrix}}" @@ -378,8 +380,27 @@ jobs: 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 + EC2SELinuxIntegrationTest: + needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] + name: 'EC2SELinux' + uses: ./.github/workflows/ec2-integration-test.yml + with: + github_sha: ${{github.sha}} + test_dir: terraform/ec2/linux + job_id: ec2-linux-integration-test + test_props: ${{needs.GenerateTestMatrix.outputs.ec2_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 + EC2LinuxIntegrationTestITAR: needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] name: 'EC2LinuxITAR' From 762551f9a09832ce00084a617182909b27f56777 Mon Sep 17 00:00:00 2001 From: Paramadon Date: Mon, 10 Mar 2025 11:34:02 -0400 Subject: [PATCH 2/8] fixing workflow --- .github/workflows/deploy-canary.yml | 2 +- .github/workflows/integration-test.yml | 2 +- .github/workflows/test-artifacts.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-canary.yml b/.github/workflows/deploy-canary.yml index fa873bca00..93fc8d1555 100644 --- a/.github/workflows/deploy-canary.yml +++ b/.github/workflows/deploy-canary.yml @@ -9,7 +9,7 @@ env: PRIVATE_KEY: ${{ secrets.AWS_PRIVATE_KEY }} 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: "selinuxTest" + CWA_GITHUB_TEST_REPO_BRANCH: "main" on: schedule: diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index aa2dc3e7f2..37823e93ea 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.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: "selinuxTest" + 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 }} diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index 1dee485f74..99af29239b 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: "selinuxTest" + 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 }} From 2dcfa933ac52685a7cb3879fb41d9e31d6503afa Mon Sep 17 00:00:00 2001 From: Paramadon Date: Mon, 10 Mar 2025 11:39:18 -0400 Subject: [PATCH 3/8] fixing issue --- .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 99af29239b..ba6c12764b 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -388,7 +388,7 @@ jobs: name: 'EC2SELinux' uses: ./.github/workflows/ec2-integration-test.yml with: - github_sha: ${{github.sha}} + build_id: ${{ inputs.build_id }} test_dir: terraform/ec2/linux job_id: ec2-linux-integration-test test_props: ${{needs.GenerateTestMatrix.outputs.ec2_selinux_matrix}} From 79998b37cda0572a92ae3b16e3cba2a9e56f2a9c Mon Sep 17 00:00:00 2001 From: Paramadon Date: Mon, 10 Mar 2025 11:55:17 -0400 Subject: [PATCH 4/8] removing files from workflow --- .github/workflows/test-artifacts.yml | 511 --------------------------- 1 file changed, 511 deletions(-) diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index ba6c12764b..d53f8aac86 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -454,161 +454,6 @@ jobs: region: us-west-2 secrets: inherit - 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@v2 - with: - role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - aws-region: us-west-2 - role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - - name: Echo Test Info - run: echo run on ec2 instance os ${{ matrix.arrays.os }} use ssm ${{ matrix.arrays.useSSM }} test ${{ matrix.arrays.test_dir }} - - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 - - - name: Verify Terraform version - run: terraform --version - - # nick-fields/retry@v2 starts at base dir - - name: Terraform apply - uses: nick-fields/retry@v2 - with: - max_attempts: 3 - timeout_minutes: 30 - retry_wait_seconds: 5 - command: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - else - cd terraform/ec2/win - fi - terraform init - if terraform apply --auto-approve \ - -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - -var="ssh_key_value=${PRIVATE_KEY}" \ - -var="ssh_key_name=${KEY_NAME}" \ - -var="test_name=${{ matrix.arrays.os }}" \ - -var="cwa_github_sha=${{ inputs.build_id }}" \ - -var="test_dir=${{ matrix.arrays.test_dir }}" \ - -var="ami=${{ matrix.arrays.ami }}" \ - -var="use_ssm=${{ matrix.arrays.useSSM }}" \ - -var="s3_bucket=${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@v2 - with: - role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - aws-region: us-west-2 - role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - - name: Echo OS - run: echo run on ec2 instance os ${{ matrix.arrays.os }} - - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 - - - name: Verify Terraform version - run: terraform --version - - # nick-fields/retry@v2 starts at base dir - - name: Terraform apply - uses: nick-fields/retry@v2 - with: - max_attempts: 3 - timeout_minutes: 60 - retry_wait_seconds: 5 - command: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - else - cd terraform/ec2/mac - fi - terraform init - if terraform apply --auto-approve \ - -var="ssh_key_value=${PRIVATE_KEY}" \ - -var="ssh_key_name=${KEY_NAME}" \ - -var="arc=${{ matrix.arrays.arc }}" \ - -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - -var="cwa_github_sha=${{ 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' @@ -661,362 +506,6 @@ jobs: 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@v2 - with: - role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - aws-region: us-west-2 - role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - - name: Login ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v2 - - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 - - - name: Verify Terraform version - run: terraform --version - - - name: Terraform apply - uses: nick-fields/retry@v2 - with: - max_attempts: 3 - timeout_minutes: 15 - retry_wait_seconds: 5 - command: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - else - cd terraform/ecs_ec2/daemon - fi - - terraform init - if terraform apply --auto-approve\ - -var="test_dir=${{ matrix.arrays.test_dir }}"\ - -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ - -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ - -var="cwagent_image_tag=${{ 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@v2 - with: - role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - aws-region: us-west-2 - role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - - name: Login ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v2 - - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 - - - name: Verify Terraform version - run: terraform --version - - - name: Terraform apply - uses: nick-fields/retry@v2 - with: - max_attempts: 3 - timeout_minutes: 15 - retry_wait_seconds: 5 - command: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - else - cd terraform/ecs_fargate/linux - fi - - terraform init - if terraform apply --auto-approve\ - -var="test_dir=${{ matrix.arrays.test_dir }}"\ - -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ - -var="cwagent_image_tag=${{ 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@v2 - with: - role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - aws-region: us-west-2 - role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - - name: Login ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v2 - - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 - - - name: Verify Terraform version - run: terraform --version - - - name: Terraform apply - uses: nick-fields/retry@v2 - with: - max_attempts: 2 - timeout_minutes: 90 # EKS takes about 20 minutes to spin up a cluster and service on the cluster - retry_wait_seconds: 5 - command: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - else - cd terraform/eks/daemon - fi - - terraform init - if terraform apply --auto-approve \ - -var="test_dir=${{ matrix.arrays.test_dir }}"\ - -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \ - -var="cwagent_image_tag=${{ 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@v2 - with: - role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - aws-region: us-west-2 - role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - - name: Login ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v2 - - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 - - - name: Verify Terraform version - run: terraform --version - - - name: Terraform apply - uses: nick-fields/retry@v2 - with: - max_attempts: 3 - timeout_minutes: 60 # EKS takes about 20 minutes to spin up a cluster and service on the cluster - retry_wait_seconds: 5 - command: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - else - cd terraform/eks/deployment - fi - - terraform init - if terraform apply --auto-approve \ - -var="test_dir=${{ matrix.arrays.test_dir }}"\ - -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \ - -var="cwagent_image_tag=${{ inputs.build_id }}" \ - -var="k8s_version=${{ matrix.arrays.k8s_version }}"; then - terraform destroy -auto-approve - else - terraform destroy -auto-approve && exit 1 - fi - - - name: Terraform destroy - if: ${{ cancelled() || failure() }} - uses: nick-fields/retry@v2 - with: - max_attempts: 3 - timeout_minutes: 8 - retry_wait_seconds: 5 - command: | - if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then - cd "${{ matrix.arrays.terraform_dir }}" - else - cd terraform/eks/deployment - fi - terraform destroy --auto-approve - - PerformanceTrackingTest: - name: ${{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@v2 - with: - role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} - aws-region: us-west-2 - role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} - - - name: Install Terraform - uses: hashicorp/setup-terraform@v3 - - - name: Verify Terraform version - run: terraform --version - - - name: Terraform apply - uses: nick-fields/retry@v2 - with: - max_attempts: 1 - timeout_minutes: 60 - retry_wait_seconds: 5 - command: | - cd terraform/performance - terraform init - if terraform apply --auto-approve \ - -var="ssh_key_value=${PRIVATE_KEY}" \ - -var="cwa_github_sha=${{ 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/performance && terraform destroy --auto-approve EC2WinPerformanceTest: name: ${{matrix.arrays.testName}} From 700e46d1974997ee8662cb41d7df69a8b79deefe Mon Sep 17 00:00:00 2001 From: Paramadon Date: Mon, 10 Mar 2025 15:28:37 -0400 Subject: [PATCH 5/8] fixing generation --- .github/workflows/test-artifacts.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index d53f8aac86..d13da76ca2 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -117,6 +117,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_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" echo "ec2_performance_matrix=$(echo $(cat generator/resources/ec2_performance_complete_test_matrix.json))" >> "$GITHUB_OUTPUT" From d1778ea93761c3cb102888b9ea7fdfc1dbbec252 Mon Sep 17 00:00:00 2001 From: Paramadon Date: Wed, 12 Mar 2025 16:08:50 -0400 Subject: [PATCH 6/8] adding back tests --- .github/workflows/test-artifacts.yml | 498 +++++++++++++++++++++++++++ 1 file changed, 498 insertions(+) diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index d13da76ca2..b35087b89f 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -420,6 +420,159 @@ jobs: s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} secrets: inherit + 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@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + - name: Echo Test Info + run: echo run on ec2 instance os ${{ matrix.arrays.os }} use ssm ${{ matrix.arrays.useSSM }} test ${{ matrix.arrays.test_dir }} + + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 + + - name: Verify Terraform version + run: terraform --version + + # nick-fields/retry@v2 starts at base dir + - name: Terraform apply + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 30 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/ec2/win + fi + terraform init + if terraform apply --auto-approve \ + -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + -var="ssh_key_value=${PRIVATE_KEY}" \ + -var="ssh_key_name=${KEY_NAME}" \ + -var="test_name=${{ matrix.arrays.os }}" \ + -var="cwa_github_sha=${{ inputs.build_id }}" \ + -var="test_dir=${{ matrix.arrays.test_dir }}" \ + -var="ami=${{ matrix.arrays.ami }}" \ + -var="use_ssm=${{ matrix.arrays.useSSM }}" \ + -var="s3_bucket=${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@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + - name: Echo OS + run: echo run on ec2 instance os ${{ matrix.arrays.os }} + + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 + + - name: Verify Terraform version + run: terraform --version + + # nick-fields/retry@v2 starts at base dir + - name: Terraform apply + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 60 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/ec2/mac + fi + terraform init + if terraform apply --auto-approve \ + -var="ssh_key_value=${PRIVATE_KEY}" \ + -var="ssh_key_name=${KEY_NAME}" \ + -var="arc=${{ matrix.arrays.arc }}" \ + -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + -var="cwa_github_sha=${{ 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 + EC2LinuxIntegrationTestCN: needs: [ StartLocalStackCN, GenerateTestMatrix, OutputEnvVariables ] name: 'EC2LinuxCN' @@ -508,6 +661,351 @@ jobs: 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@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + - name: Login ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 + + - name: Verify Terraform version + run: terraform --version + + - name: Terraform apply + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 15 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/ecs_ec2/daemon + fi + terraform init + if terraform apply --auto-approve\ + -var="test_dir=${{ matrix.arrays.test_dir }}"\ + -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ + -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ + -var="cwagent_image_tag=${{ 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@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + - name: Login ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 + + - name: Verify Terraform version + run: terraform --version + + - name: Terraform apply + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 15 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/ecs_fargate/linux + fi + terraform init + if terraform apply --auto-approve\ + -var="test_dir=${{ matrix.arrays.test_dir }}"\ + -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}"\ + -var="cwagent_image_tag=${{ 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@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + - name: Login ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 + + - name: Verify Terraform version + run: terraform --version + + - name: Terraform apply + uses: nick-fields/retry@v2 + with: + max_attempts: 2 + timeout_minutes: 90 # EKS takes about 20 minutes to spin up a cluster and service on the cluster + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/eks/daemon + fi + terraform init + if terraform apply --auto-approve \ + -var="test_dir=${{ matrix.arrays.test_dir }}"\ + -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \ + -var="cwagent_image_tag=${{ 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@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + - name: Login ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 + + - name: Verify Terraform version + run: terraform --version + + - name: Terraform apply + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 60 # EKS takes about 20 minutes to spin up a cluster and service on the cluster + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/eks/deployment + fi + terraform init + if terraform apply --auto-approve \ + -var="test_dir=${{ matrix.arrays.test_dir }}"\ + -var="cwagent_image_repo=${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_INTEGRATION_TEST_REPO }}" \ + -var="cwagent_image_tag=${{ inputs.build_id }}" \ + -var="k8s_version=${{ matrix.arrays.k8s_version }}"; then + terraform destroy -auto-approve + else + terraform destroy -auto-approve && exit 1 + fi + - name: Terraform destroy + if: ${{ cancelled() || failure() }} + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 8 + retry_wait_seconds: 5 + command: | + if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then + cd "${{ matrix.arrays.terraform_dir }}" + else + cd terraform/eks/deployment + fi + terraform destroy --auto-approve + PerformanceTrackingTest: + name: ${{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@v2 + with: + role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }} + aws-region: us-west-2 + role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }} + + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 + + - name: Verify Terraform version + run: terraform --version + + - name: Terraform apply + uses: nick-fields/retry@v2 + with: + max_attempts: 1 + timeout_minutes: 60 + retry_wait_seconds: 5 + command: | + cd terraform/performance + terraform init + if terraform apply --auto-approve \ + -var="ssh_key_value=${PRIVATE_KEY}" \ + -var="cwa_github_sha=${{ 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/performance && terraform destroy --auto-approve + EC2WinPerformanceTest: name: ${{matrix.arrays.testName}} needs: [ GenerateTestMatrix, OutputEnvVariables ] From 55fc88ce9ada84d5a8a6dafe835497972145ea33 Mon Sep 17 00:00:00 2001 From: Paramadon Date: Wed, 12 Mar 2025 16:14:44 -0400 Subject: [PATCH 7/8] fixing spacing --- .github/workflows/test-artifacts.yml | 52 ++++++++++++++++++---------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index b35087b89f..7669bf59f5 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -332,6 +332,7 @@ jobs: else cd terraform/ec2/win fi + terraform init if terraform apply --auto-approve \ -var="ssh_key_value=${PRIVATE_KEY}" \ @@ -384,23 +385,6 @@ jobs: is_selinux_test: false secrets: inherit - 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 EC2LinuxIntegrationTestITAR: needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ] @@ -420,6 +404,24 @@ jobs: s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} secrets: inherit + 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}} @@ -466,6 +468,7 @@ jobs: else cd terraform/ec2/win fi + terraform init if terraform apply --auto-approve \ -var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \ @@ -542,6 +545,7 @@ jobs: else cd terraform/ec2/mac fi + terraform init if terraform apply --auto-approve \ -var="ssh_key_value=${PRIVATE_KEY}" \ @@ -591,7 +595,6 @@ jobs: s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} secrets: inherit - LinuxOnPremIntegrationTest: needs: [StartLocalStack, GenerateTestMatrix, OutputEnvVariables] name: 'OnpremLinux' @@ -660,7 +663,6 @@ jobs: github_sha: ${{inputs.build_id}} s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }} - ECSEC2IntegrationTest: name: ${{matrix.arrays.testName}} runs-on: ubuntu-latest @@ -707,6 +709,7 @@ jobs: else cd terraform/ecs_ec2/daemon fi + terraform init if terraform apply --auto-approve\ -var="test_dir=${{ matrix.arrays.test_dir }}"\ @@ -720,6 +723,7 @@ jobs: else terraform destroy -auto-approve && exit 1 fi + - name: Terraform destroy if: ${{ cancelled() || failure() }} uses: nick-fields/retry@v2 @@ -734,6 +738,7 @@ jobs: cd terraform/ecs_ec2/daemon fi terraform destroy --auto-approve + ECSFargateIntegrationTest: name: ${{matrix.arrays.testName}} runs-on: ubuntu-latest @@ -780,6 +785,7 @@ jobs: else cd terraform/ecs_fargate/linux fi + terraform init if terraform apply --auto-approve\ -var="test_dir=${{ matrix.arrays.test_dir }}"\ @@ -789,6 +795,7 @@ jobs: else terraform destroy -auto-approve && exit 1 fi + - name: Terraform destroy if: ${{ cancelled() || failure() }} uses: nick-fields/retry@v2 @@ -803,6 +810,7 @@ jobs: cd terraform/ecs_fargate/linux fi terraform destroy --auto-approve + EKSIntegrationTest: name: ${{matrix.arrays.testName}} runs-on: ubuntu-latest @@ -849,6 +857,7 @@ jobs: else cd terraform/eks/daemon fi + terraform init if terraform apply --auto-approve \ -var="test_dir=${{ matrix.arrays.test_dir }}"\ @@ -861,6 +870,7 @@ jobs: else terraform destroy -auto-approve && exit 1 fi + - name: Terraform destroy if: ${{ cancelled() || failure() }} uses: nick-fields/retry@v2 @@ -875,6 +885,7 @@ jobs: cd terraform/eks/daemon fi terraform destroy --auto-approve + EKSPrometheusIntegrationTest: name: ${{matrix.arrays.testName}} runs-on: ubuntu-latest @@ -921,6 +932,7 @@ jobs: else cd terraform/eks/deployment fi + terraform init if terraform apply --auto-approve \ -var="test_dir=${{ matrix.arrays.test_dir }}"\ @@ -945,6 +957,7 @@ jobs: cd terraform/eks/deployment fi terraform destroy --auto-approve + PerformanceTrackingTest: name: ${{matrix.arrays.testName}} needs: [ GenerateTestMatrix, OutputEnvVariables ] @@ -997,6 +1010,7 @@ jobs: else terraform destroy -auto-approve && exit 1 fi + - name: Terraform destroy if: ${{ cancelled() || failure() }} uses: nick-fields/retry@v2 From 7af2660033d9d4d6fe2b40973a0b699c7fc41d8f Mon Sep 17 00:00:00 2001 From: Paramadon Date: Wed, 12 Mar 2025 16:16:38 -0400 Subject: [PATCH 8/8] fixing spacing --- .github/workflows/test-artifacts.yml | 69 ++++++++++++++-------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/.github/workflows/test-artifacts.yml b/.github/workflows/test-artifacts.yml index 7669bf59f5..2a0d33b45e 100644 --- a/.github/workflows/test-artifacts.yml +++ b/.github/workflows/test-artifacts.yml @@ -404,6 +404,40 @@ jobs: s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }} secrets: inherit + EC2LinuxIntegrationTestCN: + needs: [ StartLocalStackCN, GenerateTestMatrix, OutputEnvVariables ] + name: 'EC2LinuxCN' + uses: ./.github/workflows/ec2-integration-test.yml + with: + 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: 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_onprem + job_id: linux-onprem-integration-test + test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_onprem_matrix}} + test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} + test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} + test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} + localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} + region: us-west-2 + secrets: inherit + EC2SELinuxIntegrationTest: needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ] name: 'EC2SELinux' @@ -577,41 +611,6 @@ jobs: fi terraform destroy --auto-approve - 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: 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_onprem - job_id: linux-onprem-integration-test - test_props: ${{needs.GenerateTestMatrix.outputs.ec2_linux_onprem_matrix}} - test_repo_name: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }} - test_repo_url: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }} - test_repo_branch: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} - localstack_host: ${{needs.StartLocalStack.outputs.local_stack_host_name}} - region: us-west-2 - secrets: inherit - - StopLocalStack: name: 'StopLocalStack' if: ${{ always() && needs.StartLocalStack.result == 'success' }}