Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
178 changes: 177 additions & 1 deletion .github/workflows/test-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: "feature/workload-discovery"
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 }}
Expand Down Expand Up @@ -130,8 +130,10 @@ jobs:
runs-on: ubuntu-latest
outputs:
ec2_gpu_matrix: ${{ steps.set-matrix.outputs.ec2_gpu_matrix }}
ec2_linux_nvidia_matrix: ${{ steps.set-matrix.outputs.ec2_linux_nvidia_matrix }}
ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_matrix }}
ec2_selinux_matrix: ${{ steps.set-matrix.outputs.ec2_selinux_matrix }}
ec2_windows_nvidia_matrix: ${{ steps.set-matrix.outputs.ec2_windows_nvidia_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}}
Expand Down Expand Up @@ -162,8 +164,10 @@ jobs:
go run --tags=generator generator/test_case_generator.go
echo "ec2_gpu_matrix=$(echo $(cat generator/resources/ec2_gpu_complete_test_matrix.json))" >> "$GITHUB_OUTPUT"
echo "eks_addon_matrix=$(echo $(cat generator/resources/eks_addon_complete_test_matrix.json))" >> "$GITHUB_OUTPUT"
echo "ec2_linux_nvidia_matrix=$(echo $(cat generator/resources/ec2_linux_nvidia_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_nvidia_matrix=$(echo $(cat generator/resources/ec2_windows_nvidia_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"
Expand All @@ -181,8 +185,10 @@ jobs:
run: |
echo "ec2_gpu_matrix: ${{ steps.set-matrix.outputs.ec2_gpu_matrix }}"
echo "eks_addon_matrix: ${{ steps.set-matrix.outputs.eks_addon_matrix }}"
echo "ec2_linux_nvidia_matrix: ${{ steps.set-matrix.outputs.ec2_linux_nvidia_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_nvidia_matrix: ${{ steps.set-matrix.outputs.ec2_windows_nvidia_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}}"
Expand Down Expand Up @@ -414,6 +420,175 @@ jobs:
fi
terraform destroy --auto-approve
EC2NvidiaNVIDIALinuxWDIntegrationTest:
needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ]
name: ${{matrix.arrays.testName}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_linux_nvidia_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

- 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/linux
fi
terraform init
if terraform apply --auto-approve \
-var="ssh_key_value=${{env.PRIVATE_KEY}}" \
-var="github_test_repo=${{ needs.OutputEnvVariables.outputs.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=${{ vars.S3_INTEGRATION_BUCKET }}" \
-var="ssh_key_name=${{env.KEY_NAME}}" \
-var="test_dir=${{ matrix.arrays.test_dir }}" \
-var="agent_start=${{ matrix.arrays.agentStartCommand }}" \
-var="excluded_tests='${{ matrix.arrays.excludedTests }}'" \
-var="plugin_tests='${{ github.event.inputs.plugins }}'"; 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/ec2/linux
fi
terraform destroy -lock-timeout=5m -var="ami=${{ matrix.arrays.ami }}" --auto-approve
EC2NvidiaNVIDIAWindowsWDIntegrationTest:
needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ]
name: ${{matrix.arrays.testName}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_nvidia_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

- 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="github_test_repo_branch=${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" \
-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="s3_bucket=${S3_INTEGRATION_BUCKET}" ; 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/ec2/win
fi
terraform destroy -lock-timeout=5m -var="ami=${{ matrix.arrays.ami }}" --auto-approve
EC2LinuxIntegrationTest:
needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ]
name: 'EC2Linux'
Expand Down Expand Up @@ -539,6 +714,7 @@ jobs:
terraform init
if terraform apply --auto-approve \
-var="github_test_repo_branch=${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" \
-var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \
-var="ssh_key_value=${PRIVATE_KEY}" \
-var="ssh_key_name=${KEY_NAME}" \
Expand Down
Loading