Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SELinux Integration Test for CloudWatch Agent #1589

Merged
merged 8 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .github/workflows/ec2-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ on:
type: string
terraform_assume_role:
type: string
is_selinux_test:
type: boolean
s3_integration_bucket:
type: string

Expand Down Expand Up @@ -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 }}" \
Expand Down
44 changes: 33 additions & 11 deletions .github/workflows/test-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -116,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"
Expand All @@ -134,6 +136,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}}"
Expand Down Expand Up @@ -329,6 +332,7 @@ jobs:
else
cd terraform/ec2/win
fi

terraform init
if terraform apply --auto-approve \
-var="ssh_key_value=${PRIVATE_KEY}" \
Expand Down Expand Up @@ -378,8 +382,10 @@ 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


EC2LinuxIntegrationTestITAR:
needs: [ StartLocalStackITAR, GenerateTestMatrix, OutputEnvVariables ]
name: 'EC2LinuxITAR'
Expand Down Expand Up @@ -416,7 +422,6 @@ jobs:
s3_integration_bucket: ${{ vars.S3_INTEGRATION_BUCKET_CN }}
secrets: inherit


LinuxOnPremIntegrationTest:
needs: [StartLocalStack, GenerateTestMatrix, OutputEnvVariables]
name: 'OnpremLinux'
Expand All @@ -433,6 +438,24 @@ jobs:
region: us-west-2
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}}
Expand Down Expand Up @@ -479,6 +502,7 @@ jobs:
else
cd terraform/ec2/win
fi

terraform init
if terraform apply --auto-approve \
-var="ec2_instance_type=${{ matrix.arrays.instanceType }}" \
Expand All @@ -494,7 +518,6 @@ jobs:
else
terraform destroy -auto-approve && exit 1
fi

#This is here just in case workflow cancel
- name: Terraform destroy
if: ${{ cancelled() || failure() }}
Expand All @@ -510,7 +533,6 @@ jobs:
cd terraform/ec2/win
fi
terraform destroy --auto-approve

EC2DarwinIntegrationTest:
needs: [GenerateTestMatrix, OutputEnvVariables]
name: ${{matrix.arrays.testName}}
Expand Down Expand Up @@ -557,6 +579,7 @@ jobs:
else
cd terraform/ec2/mac
fi

terraform init
if terraform apply --auto-approve \
-var="ssh_key_value=${PRIVATE_KEY}" \
Expand All @@ -572,7 +595,6 @@ jobs:
else
terraform destroy -auto-approve && exit 1
fi

#This is here just in case workflow cancel
- name: Terraform destroy
if: ${{ cancelled() || failure() }}
Expand Down Expand Up @@ -686,7 +708,7 @@ jobs:
else
cd terraform/ecs_ec2/daemon
fi

terraform init
if terraform apply --auto-approve\
-var="test_dir=${{ matrix.arrays.test_dir }}"\
Expand Down Expand Up @@ -719,7 +741,7 @@ jobs:
ECSFargateIntegrationTest:
name: ${{matrix.arrays.testName}}
runs-on: ubuntu-latest
needs: [GenerateTestMatrix, OutputEnvVariables]
needs: [ GenerateTestMatrix, OutputEnvVariables ]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -762,7 +784,7 @@ jobs:
else
cd terraform/ecs_fargate/linux
fi

terraform init
if terraform apply --auto-approve\
-var="test_dir=${{ matrix.arrays.test_dir }}"\
Expand All @@ -772,6 +794,7 @@ jobs:
else
terraform destroy -auto-approve && exit 1
fi

- name: Terraform destroy
if: ${{ cancelled() || failure() }}
uses: nick-fields/retry@v2
Expand Down Expand Up @@ -833,7 +856,7 @@ jobs:
else
cd terraform/eks/daemon
fi

terraform init
if terraform apply --auto-approve \
-var="test_dir=${{ matrix.arrays.test_dir }}"\
Expand Down Expand Up @@ -908,7 +931,7 @@ jobs:
else
cd terraform/eks/deployment
fi

terraform init
if terraform apply --auto-approve \
-var="test_dir=${{ matrix.arrays.test_dir }}"\
Expand All @@ -919,7 +942,6 @@ jobs:
else
terraform destroy -auto-approve && exit 1
fi

- name: Terraform destroy
if: ${{ cancelled() || failure() }}
uses: nick-fields/retry@v2
Expand All @@ -937,7 +959,7 @@ jobs:

PerformanceTrackingTest:
name: ${{matrix.arrays.testName}}
needs: [GenerateTestMatrix, OutputEnvVariables]
needs: [ GenerateTestMatrix, OutputEnvVariables ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down