Skip to content

Commit 0c4c260

Browse files
committed
Update workflow for workload discovery integration tests
1 parent 95fbd16 commit 0c4c260

File tree

1 file changed

+177
-1
lines changed

1 file changed

+177
-1
lines changed

.github/workflows/test-artifacts.yml

Lines changed: 177 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
ECR_INTEGRATION_TEST_REPO: "cwagent-integration-test"
1414
CWA_GITHUB_TEST_REPO_NAME: "aws/amazon-cloudwatch-agent-test"
1515
CWA_GITHUB_TEST_REPO_URL: "https://github.com/aws/amazon-cloudwatch-agent-test.git"
16-
CWA_GITHUB_TEST_REPO_BRANCH: "main"
16+
CWA_GITHUB_TEST_REPO_BRANCH: "feature/workload-discovery"
1717
TERRAFORM_AWS_ASSUME_ROLE_ITAR: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }}
1818
S3_INTEGRATION_BUCKET_ITAR: ${{ vars.S3_INTEGRATION_BUCKET_ITAR }}
1919
TERRAFORM_AWS_ASSUME_ROLE_CN: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }}
@@ -130,8 +130,10 @@ jobs:
130130
runs-on: ubuntu-latest
131131
outputs:
132132
ec2_gpu_matrix: ${{ steps.set-matrix.outputs.ec2_gpu_matrix }}
133+
ec2_linux_nvidia_matrix: ${{ steps.set-matrix.outputs.ec2_linux_nvidia_matrix }}
133134
ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_matrix }}
134135
ec2_selinux_matrix: ${{ steps.set-matrix.outputs.ec2_selinux_matrix }}
136+
ec2_windows_nvidia_matrix: ${{ steps.set-matrix.outputs.ec2_windows_nvidia_matrix }}
135137
ec2_windows_matrix: ${{ steps.set-matrix.outputs.ec2_windows_matrix }}
136138
ec2_mac_matrix: ${{ steps.set-matrix.outputs.ec2_mac_matrix }}
137139
ec2_performance_matrix: ${{steps.set-matrix.outputs.ec2_performance_matrix}}
@@ -162,8 +164,10 @@ jobs:
162164
go run --tags=generator generator/test_case_generator.go
163165
echo "ec2_gpu_matrix=$(echo $(cat generator/resources/ec2_gpu_complete_test_matrix.json))" >> "$GITHUB_OUTPUT"
164166
echo "eks_addon_matrix=$(echo $(cat generator/resources/eks_addon_complete_test_matrix.json))" >> "$GITHUB_OUTPUT"
167+
echo "ec2_linux_nvidia_matrix=$(echo $(cat generator/resources/ec2_linux_nvidia_complete_test_matrix.json))" >> "$GITHUB_OUTPUT"
165168
echo "ec2_linux_matrix=$(echo $(cat generator/resources/ec2_linux_complete_test_matrix.json))" >> "$GITHUB_OUTPUT"
166169
echo "ec2_selinux_matrix=$(echo $(cat generator/resources/ec2_selinux_complete_test_matrix.json))" >> "$GITHUB_OUTPUT"
170+
echo "ec2_windows_nvidia_matrix=$(echo $(cat generator/resources/ec2_windows_nvidia_complete_test_matrix.json))" >> "$GITHUB_OUTPUT"
167171
echo "ec2_windows_matrix=$(echo $(cat generator/resources/ec2_windows_complete_test_matrix.json))" >> "$GITHUB_OUTPUT"
168172
echo "ec2_mac_matrix=$(echo $(cat generator/resources/ec2_mac_complete_test_matrix.json))" >> "$GITHUB_OUTPUT"
169173
echo "ec2_performance_matrix=$(echo $(cat generator/resources/ec2_performance_complete_test_matrix.json))" >> "$GITHUB_OUTPUT"
@@ -181,8 +185,10 @@ jobs:
181185
run: |
182186
echo "ec2_gpu_matrix: ${{ steps.set-matrix.outputs.ec2_gpu_matrix }}"
183187
echo "eks_addon_matrix: ${{ steps.set-matrix.outputs.eks_addon_matrix }}"
188+
echo "ec2_linux_nvidia_matrix: ${{ steps.set-matrix.outputs.ec2_linux_nvidia_matrix }}"
184189
echo "ec2_linux_matrix: ${{ steps.set-matrix.outputs.ec2_linux_matrix }}"
185190
echo "ec2_selinux_matrix: ${{ steps.set-matrix.outputs.ec2_selinux_matrix }}"
191+
echo "ec2_windows_nvidia_matrix: ${{ steps.set-matrix.outputs.ec2_windows_nvidia_matrix }}"
186192
echo "ec2_windows_matrix: ${{ steps.set-matrix.outputs.ec2_windows_matrix }}"
187193
echo "ec2_mac_matrix: ${{ steps.set-matrix.outputs.ec2_mac_matrix }}"
188194
echo "ec2_performance_matrix: ${{ steps.set-matrix.outputs.ec2_performance_matrix}}"
@@ -414,6 +420,175 @@ jobs:
414420
fi
415421
terraform destroy --auto-approve
416422
423+
EC2NvidiaNVIDIALinuxWDIntegrationTest:
424+
needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ]
425+
name: ${{matrix.arrays.testName}}
426+
runs-on: ubuntu-latest
427+
strategy:
428+
fail-fast: false
429+
matrix:
430+
arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_linux_nvidia_matrix) }}
431+
permissions:
432+
id-token: write
433+
contents: read
434+
steps:
435+
- uses: actions/checkout@v3
436+
with:
437+
repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }}
438+
ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
439+
440+
- name: Configure AWS Credentials
441+
uses: aws-actions/configure-aws-credentials@v4
442+
with:
443+
role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }}
444+
aws-region: us-west-2
445+
role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }}
446+
447+
- name: Echo Test Info
448+
run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }}
449+
450+
- name: Install Terraform
451+
uses: hashicorp/setup-terraform@v3
452+
with:
453+
terraform_version: 1.12.0
454+
455+
- name: Verify Terraform version
456+
run: terraform --version
457+
458+
- name: Terraform apply
459+
uses: nick-fields/retry@v2
460+
with:
461+
max_attempts: 3
462+
timeout_minutes: 30
463+
retry_wait_seconds: 5
464+
command: |
465+
if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then
466+
cd "${{ matrix.arrays.terraform_dir }}"
467+
else
468+
cd terraform/ec2/linux
469+
fi
470+
471+
terraform init
472+
if terraform apply --auto-approve \
473+
-var="ssh_key_value=${{env.PRIVATE_KEY}}" \
474+
-var="github_test_repo=${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_URL }}" \
475+
-var="test_name=${{ matrix.arrays.os }}" \
476+
-var="cwa_github_sha=${{inputs.build_id}}" \
477+
-var="install_agent=${{ matrix.arrays.installAgentCommand }}" \
478+
-var="github_test_repo_branch=${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" \
479+
-var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \
480+
-var="user=${{ matrix.arrays.username }}" \
481+
-var="ami=${{ matrix.arrays.ami }}" \
482+
-var="ca_cert_path=${{ matrix.arrays.caCertPath }}" \
483+
-var="arc=${{ matrix.arrays.arc }}" \
484+
-var="binary_name=${{ matrix.arrays.binaryName }}" \
485+
-var="local_stack_host_name=${{ needs.StartLocalStack.outputs.local_stack_host_name }}" \
486+
-var="s3_bucket=${{ vars.S3_INTEGRATION_BUCKET }}" \
487+
-var="ssh_key_name=${{env.KEY_NAME}}" \
488+
-var="test_dir=${{ matrix.arrays.test_dir }}" \
489+
-var="agent_start=${{ matrix.arrays.agentStartCommand }}" \
490+
-var="excluded_tests='${{ matrix.arrays.excludedTests }}'" \
491+
-var="plugin_tests='${{ github.event.inputs.plugins }}'"; then terraform destroy -auto-approve
492+
else
493+
terraform destroy -auto-approve && exit 1
494+
fi
495+
496+
- name: Terraform destroy
497+
if: ${{ (cancelled() || failure()) }}
498+
uses: nick-fields/retry@v2
499+
with:
500+
max_attempts: 3
501+
timeout_minutes: 8
502+
retry_wait_seconds: 5
503+
command: |
504+
if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then
505+
cd "${{ matrix.arrays.terraform_dir }}"
506+
else
507+
cd terraform/ec2/linux
508+
fi
509+
510+
terraform destroy -lock-timeout=5m -var="ami=${{ matrix.arrays.ami }}" --auto-approve
511+
512+
EC2NvidiaNVIDIAWindowsWDIntegrationTest:
513+
needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ]
514+
name: ${{matrix.arrays.testName}}
515+
runs-on: ubuntu-latest
516+
strategy:
517+
fail-fast: false
518+
matrix:
519+
arrays: ${{ fromJson(needs.GenerateTestMatrix.outputs.ec2_windows_nvidia_matrix) }}
520+
permissions:
521+
id-token: write
522+
contents: read
523+
steps:
524+
- uses: actions/checkout@v3
525+
with:
526+
repository: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_NAME }}
527+
ref: ${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
528+
529+
- name: Configure AWS Credentials
530+
uses: aws-actions/configure-aws-credentials@v4
531+
with:
532+
role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }}
533+
aws-region: us-west-2
534+
role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }}
535+
536+
- name: Echo Test Info
537+
run: echo run on ec2 instance os ${{ matrix.arrays.os }} arc ${{ matrix.arrays.arc }} test dir ${{ matrix.arrays.test_dir }}
538+
539+
- name: Install Terraform
540+
uses: hashicorp/setup-terraform@v3
541+
with:
542+
terraform_version: 1.12.0
543+
544+
- name: Verify Terraform version
545+
run: terraform --version
546+
547+
- name: Terraform apply
548+
uses: nick-fields/retry@v2
549+
with:
550+
max_attempts: 3
551+
timeout_minutes: 60
552+
retry_wait_seconds: 5
553+
command: |
554+
if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then
555+
cd "${{ matrix.arrays.terraform_dir }}"
556+
else
557+
cd terraform/ec2/win
558+
fi
559+
560+
terraform init
561+
if terraform apply --auto-approve \
562+
-var="github_test_repo_branch=${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" \
563+
-var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \
564+
-var="ssh_key_value=${PRIVATE_KEY}" \
565+
-var="ssh_key_name=${KEY_NAME}" \
566+
-var="test_name=${{ matrix.arrays.os }}" \
567+
-var="cwa_github_sha=${{ inputs.build_id }}" \
568+
-var="test_dir=${{ matrix.arrays.test_dir }}" \
569+
-var="ami=${{ matrix.arrays.ami }}" \
570+
-var="s3_bucket=${S3_INTEGRATION_BUCKET}" ; then
571+
terraform destroy -auto-approve
572+
else
573+
terraform destroy -auto-approve && exit 1
574+
fi
575+
576+
- name: Terraform destroy
577+
if: ${{ (cancelled() || failure()) }}
578+
uses: nick-fields/retry@v2
579+
with:
580+
max_attempts: 3
581+
timeout_minutes: 8
582+
retry_wait_seconds: 5
583+
command: |
584+
if [ "${{ matrix.arrays.terraform_dir }}" != "" ]; then
585+
cd "${{ matrix.arrays.terraform_dir }}"
586+
else
587+
cd terraform/ec2/win
588+
fi
589+
590+
terraform destroy -lock-timeout=5m -var="ami=${{ matrix.arrays.ami }}" --auto-approve
591+
417592
EC2LinuxIntegrationTest:
418593
needs: [ StartLocalStack, GenerateTestMatrix, OutputEnvVariables ]
419594
name: 'EC2Linux'
@@ -539,6 +714,7 @@ jobs:
539714
540715
terraform init
541716
if terraform apply --auto-approve \
717+
-var="github_test_repo_branch=${{ needs.OutputEnvVariables.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}" \
542718
-var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \
543719
-var="ssh_key_value=${PRIVATE_KEY}" \
544720
-var="ssh_key_name=${KEY_NAME}" \

0 commit comments

Comments
 (0)