1- # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2- # SPDX-License-Identifier: MIT
3-
4- name : Reusable EKS E2E Test
1+ name : Generate EKS Performance Test Cluster
52
63env :
4+ TERRAFORM_AWS_ASSUME_ROLE : ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
75 TERRAFORM_AWS_ASSUME_ROLE_DURATION : 14400 # 4 hours
6+ ECR_INTEGRATION_TEST_REPO : " cwagent-integration-test"
7+ CWA_GITHUB_TEST_REPO_NAME : " aws/amazon-cloudwatch-agent-test"
8+ CWA_GITHUB_TEST_REPO_URL : " https://github.com/aws/amazon-cloudwatch-agent-test.git"
9+ CWA_GITHUB_TEST_REPO_BRANCH : " scale-testing"
10+ TERRAFORM_AWS_ASSUME_ROLE_ITAR : ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }}
11+ TERRAFORM_AWS_ASSUME_ROLE_CN : ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }}
12+ OPERATOR_GITHUB_REPO_NAME : " aws/amazon-cloudwatch-agent-operator"
813
914on :
10- workflow_call :
15+ schedule :
16+ - cron : ' 0 17 * * 1'
17+ workflow_dispatch :
1118 inputs :
12- terraform_dir :
13- required : true
14- type : string
15- job_id :
16- required : true
17- type : string
18- test_props :
19- required : true
20- type : string
21- test_repo_name :
19+ cluster_name :
2220 required : true
2321 type : string
24- test_repo_url :
22+ cloudwatch_agent_operator_repository :
2523 required : true
2624 type : string
27- test_repo_branch :
25+ cloudwatch_agent_operator_tag :
2826 required : true
2927 type : string
3028 cloudwatch_agent_repository :
3331 cloudwatch_agent_tag :
3432 required : true
3533 type : string
36- cloudwatch_agent_operator_repository :
37- required : true
38- type : string
39- cloudwatch_agent_target_allocator_repository :
34+ helm-charts-branch :
4035 required : false
4136 type : string
42- cloudwatch_agent_operator_tag :
43- required : true
44- type : string
45- region :
46- required : true
47- type : string
48- helm_charts_branch :
49- required : true
50- type : string
51- terraform_assume_role :
52- required : true
53- type : string
54- agent_config :
55- required : true
56- type : string
57- prometheus_config :
37+ description : ' Branch of the helm charts to test'
38+ default : ' main'
39+ operator-branch :
5840 required : false
5941 type : string
60- default : " "
61- otel_config :
42+ description : ' Branch of the operator to test'
43+ default : ' main'
44+ region :
6245 required : false
6346 type : string
64- default : " "
65- sample_app :
66- required : true
67- type : string
68- eks_installation_type :
69- required : true
70- type : string
47+ description : ' AWS Region to run tests in'
48+ default : ' us-west-2'
7149
7250jobs :
73- EKSE2ETest :
74- name : ' EKSE2ETest'
51+ GetLatestOperatorCommitSHA :
52+ runs-on : ubuntu-latest
53+ outputs :
54+ operator_commit_sha : ${{steps.get_latest_sha.outputs.operator_sha}}
55+ operator_repo_name : ${{env.OPERATOR_GITHUB_REPO_NAME}}
56+ steps :
57+ - name : Checkout the target repo
58+ uses : actions/checkout@v3
59+ with :
60+ repository : ${{env.OPERATOR_GITHUB_REPO_NAME}}
61+ ref : ${{ inputs.operator-branch || 'main' }}
62+ path : operator-repo
63+
64+ - name : Get latest commit SHA
65+ id : get_latest_sha
66+ run : |
67+ cd operator-repo
68+ latest_sha=$(git rev-parse HEAD)
69+ echo "::set-output name=operator_sha::$latest_sha"
70+
71+ BuildAgent :
72+ uses : ./.github/workflows/build-test-artifacts.yml
73+ concurrency :
74+ group : " Build-Test-Artifacts-${{github.ref_name}}"
75+ cancel-in-progress : true
76+ secrets : inherit
77+ permissions :
78+ id-token : write
79+ contents : read
80+ with :
81+ test-image-before-upload : false
82+
83+ BuildOperator :
84+ needs : [GetLatestOperatorCommitSHA]
85+ uses : aws/amazon-cloudwatch-agent-operator/.github/workflows/build-and-upload.yml@main
86+ concurrency :
87+ group : ${{ github.workflow }}-operator-${{ inputs.operator-branch || 'main' }}
88+ cancel-in-progress : true
89+ secrets : inherit
90+ with :
91+ tag : ${{needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha}}
92+ target-sha : ${{needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha}}
93+ repository : ${{needs.GetLatestOperatorCommitSHA.outputs.operator_repo_name}}
94+ test-image-before-upload : false
95+
96+ OutputEnvVariables :
97+ needs : [ BuildAgent, BuildOperator ]
98+ name : ' OutputEnvVariables'
99+ runs-on : ubuntu-latest
100+ outputs :
101+ CWA_GITHUB_TEST_REPO_NAME : ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}
102+ CWA_GITHUB_TEST_REPO_URL : ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}
103+ CWA_GITHUB_TEST_REPO_BRANCH : ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
104+ ECR_INTEGRATION_TEST_REPO : ${{ steps.set-outputs.outputs.ECR_INTEGRATION_TEST_REPO }}
105+ ECR_OPERATOR_REPO : ${{ steps.set-outputs.outputs.ECR_OPERATOR_REPO }}
106+ steps :
107+ - uses : actions/checkout@v3
108+ with :
109+ repository : ${{env.CWA_GITHUB_TEST_REPO_NAME}}
110+ ref : ${{env.CWA_GITHUB_TEST_REPO_BRANCH}}
111+
112+ - name : Set up Go 1.x
113+ uses : actions/setup-go@v4
114+ with :
115+ go-version : ~1.22.2
116+
117+ - name : SetOutputs
118+ id : set-outputs
119+ run : |
120+ echo "::set-output name=CWA_GITHUB_TEST_REPO_NAME::${{ env.CWA_GITHUB_TEST_REPO_NAME }}"
121+ echo "::set-output name=CWA_GITHUB_TEST_REPO_URL::${{ env.CWA_GITHUB_TEST_REPO_URL }}"
122+ echo "::set-output name=CWA_GITHUB_TEST_REPO_BRANCH::${{ env.CWA_GITHUB_TEST_REPO_BRANCH }}"
123+ echo "::set-output name=ECR_INTEGRATION_TEST_REPO::cwagent-integration-test"
124+ echo "::set-output name=ECR_OPERATOR_REPO::$(echo "${{ vars.ECR_OPERATOR_STAGING_REPO }}" | awk -F'/' '{print $NF}')"
125+
126+ - name : Echo test variables
127+ run : |
128+ echo "CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}"
129+ echo "CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}"
130+ echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}"
131+ echo "ECR_INTEGRATION_TEST_REPO: ${{ steps.set-outputs.outputs.ECR_INTEGRATION_TEST_REPO }}"
132+ echo "ECR_OPERATOR_REPO: ${{ steps.set-outputs.outputs.ECR_OPERATOR_REPO }}"
133+
134+ GenerateEKSPerformanceCluster :
135+ needs : [OutputEnvVariables]
136+ name : GenerateEKSPerformanceCluster
75137 runs-on : ubuntu-latest
76138 strategy :
77139 fail-fast : false
78- matrix :
79- arrays : ${{ fromJson(inputs.test_props) }}
80140 permissions :
81141 id-token : write
82142 contents : read
143+
83144 steps :
84145 - uses : actions/checkout@v3
85146 with :
@@ -105,6 +166,9 @@ jobs:
105166 - name : Verify Terraform version
106167 run : terraform --version
107168
169+ - name : Terraform Init
170+ run : terraform init
171+
108172 - name : Terraform apply
109173 uses : nick-fields/retry@v2
110174 with :
@@ -115,14 +179,12 @@ jobs:
115179 if [ "${{ inputs.terraform_dir }}" != "" ]; then
116180 cd "${{ inputs.terraform_dir }}"
117181 else
118- cd terraform/eks/e2e
182+ cd terraform/eks/performance
119183 fi
120184
121- terraform init
122185 if terraform apply --auto-approve \
123186 -var="region=${{ inputs.region }}" \
124- -var="k8s_version=${{ matrix.arrays.k8s_version }}" \
125- -var="nodes=${{ matrix.arrays.nodes }}" \
187+ -var="var.cluster_name=${{ inputs.cluster_name }}" \
126188 -var="helm_charts_branch=${{ inputs.helm_charts_branch }}" \
127189 -var="cloudwatch_agent_repository_url=${{ steps.login-ecr.outputs.registry }}" \
128190 -var="cloudwatch_agent_repository=${{ inputs.cloudwatch_agent_repository }}" \
@@ -131,30 +193,35 @@ jobs:
131193 -var="cloudwatch_agent_operator_repository=${{ inputs.cloudwatch_agent_operator_repository }}" \
132194 -var="cloudwatch_agent_operator_tag=${{ inputs.cloudwatch_agent_operator_tag }}" \
133195 -var="cloudwatch_agent_target_allocator_repository_url=${{ steps.login-ecr.outputs.registry }}" \
134- -var="cloudwatch_agent_target_allocator_repository=${{ inputs.cloudwatch_agent_target_allocator_repository }}" \
135196 -var="cloudwatch_agent_target_allocator_tag=${{ inputs.cloudwatch_agent_operator_tag }}" \
136- -var="test_dir=${{ matrix.arrays.test_dir }}" \
137- -var="agent_config=${{ inputs.agent_config }}" \
138- -var="prometheus_config=${{ inputs.prometheus_config }}" \
139- -var="otel_config=${{ inputs.otel_config }}" \
140- -var="sample_app=${{ inputs.sample_app }}" \
141- -var="eks_installation_type=${{ inputs.eks_installation_type }}"; then
142- terraform destroy --auto-approve
143- else
144- terraform destroy --auto-approve && exit 1
145197 fi
146198
147- - name : Terraform destroy
148- if : ${{ cancelled() || failure() }}
149- uses : nick-fields/retry@v2
150- with :
151- max_attempts : 3
152- timeout_minutes : 8
153- retry_wait_seconds : 5
154- command : |
155- if [ "${{ inputs.terraform_dir }}" != "" ]; then
156- cd "${{ inputs.terraform_dir }}"
157- else
158- cd terraform/eks/e2e
159- fi
160- terraform destroy --auto-approve
199+ # CleanupEKSPerformanceCluster:
200+ # needs: [ GenerateEKSPerformanceCluster ]
201+ # runs-on: ubuntu-latest
202+ # steps:
203+ # - name: Checkout Repository
204+ # uses: actions/checkout@v3
205+ #
206+ # - name: Configure AWS Credentials
207+ # uses: aws-actions/configure-aws-credentials@v4
208+ # with:
209+ # role-to-assume: ${{ env.TERRAFORM_AWS_ASSUME_ROLE }}
210+ # aws-region: ${{ inputs.region || 'us-west-2' }}
211+ # role-duration-seconds: ${{ env.TERRAFORM_AWS_ASSUME_ROLE_DURATION }}
212+ #
213+ # - name: Setup Terraform
214+ # uses: hashicorp/setup-terraform@v3
215+ # with:
216+ # terraform_version: 1.12.0
217+ #
218+ # - name: Terraform Init
219+ # run: terraform init
220+ #
221+ #
222+ # - name: Terraform destroy
223+ # run: terraform destroy --auto-approve \
224+ # -var="region=${{ inputs.region || 'us-west-2' }}" \
225+ # -var="cluster_name=${{ inputs.cluster_name }}" \
226+ # -var="eks_deployment_strategy=DAEMON"
227+
0 commit comments