-
Notifications
You must be signed in to change notification settings - Fork 214
246 lines (234 loc) · 11.4 KB
/
e2e-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT
name: Run E2E Tests
env:
TERRAFORM_AWS_ASSUME_ROLE: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
TERRAFORM_AWS_ASSUME_ROLE_DURATION: 14400 # 4 hours
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: "e2e-rosa"
TERRAFORM_AWS_ASSUME_ROLE_ITAR: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_ITAR }}
TERRAFORM_AWS_ASSUME_ROLE_CN: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE_CN }}
OPERATOR_GITHUB_REPO_NAME: "aws/amazon-cloudwatch-agent-operator"
on:
schedule:
- cron: '0 17 * * 1'
push:
branches:
- rosa
workflow_dispatch:
inputs:
region:
required: false
type: string
description: 'AWS Region to run tests in'
default: 'us-east-1'
operator-branch:
required: false
type: string
description: 'Branch of the operator to test'
default: 'main'
helm-charts-branch:
required: false
type: string
description: 'Branch of the helm charts to test'
default: 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-parent
cancel-in-progress: true
jobs:
# GetLatestOperatorCommitSHA:
# runs-on: ubuntu-latest
# outputs:
# operator_commit_sha: ${{steps.get_latest_sha.outputs.operator_sha}}
# operator_repo_name: ${{env.OPERATOR_GITHUB_REPO_NAME}}
# steps:
# - name: Checkout the target repo
# uses: actions/checkout@v3
# with:
# repository: ${{env.OPERATOR_GITHUB_REPO_NAME}}
# ref: ${{ inputs.operator-branch || 'main' }}
# path: operator-repo
#
# - name: Get latest commit SHA
# id: get_latest_sha
# run: |
# cd operator-repo
# latest_sha=$(git rev-parse HEAD)
# echo "::set-output name=operator_sha::$latest_sha"
#
# BuildAgent:
# uses: ./.github/workflows/build-test-artifacts.yml
# concurrency:
# group: "Build-Test-Artifacts-${{github.ref_name}}"
# cancel-in-progress: true
# secrets: inherit
# permissions:
# id-token: write
# contents: read
# with:
# test-image-before-upload: false
#
# BuildOperator:
# needs: [GetLatestOperatorCommitSHA]
# uses: aws/amazon-cloudwatch-agent-operator/.github/workflows/build-and-upload.yml@main
# concurrency:
# group: ${{ github.workflow }}-operator-${{ inputs.operator-branch || 'main' }}
# cancel-in-progress: true
# secrets: inherit
# with:
# tag: ${{needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha}}
# target-sha: ${{needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha}}
# repository: ${{needs.GetLatestOperatorCommitSHA.outputs.operator_repo_name}}
# test-image-before-upload: false
#
OutputEnvVariables:
# needs: [ BuildAgent, BuildOperator ]
name: 'OutputEnvVariables'
runs-on: ubuntu-latest
outputs:
CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}
CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}
CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
ECR_INTEGRATION_TEST_REPO: ${{ steps.set-outputs.outputs.ECR_INTEGRATION_TEST_REPO }}
ECR_OPERATOR_REPO: ${{ steps.set-outputs.outputs.ECR_OPERATOR_REPO }}
ECR_TARGET_ALLOCATOR_REPO: ${{ steps.set-outputs.outputs.ECR_TARGET_ALLOCATOR_REPO }}
steps:
- uses: actions/checkout@v3
with:
repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}}
ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}}
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
- name: SetOutputs
id: set-outputs
run: |
echo "::set-output name=CWA_GITHUB_TEST_REPO_NAME::${{ env.CWA_GITHUB_TEST_REPO_NAME }}"
echo "::set-output name=CWA_GITHUB_TEST_REPO_URL::${{ env.CWA_GITHUB_TEST_REPO_URL }}"
echo "::set-output name=CWA_GITHUB_TEST_REPO_BRANCH::${{ env.CWA_GITHUB_TEST_REPO_BRANCH }}"
echo "::set-output name=ECR_INTEGRATION_TEST_REPO::cwagent-integration-test"
echo "::set-output name=ECR_OPERATOR_REPO::$(echo "${{ vars.ECR_OPERATOR_STAGING_REPO }}" | awk -F'/' '{print $NF}')"
echo "::set-output name=ECR_TARGET_ALLOCATOR_REPO::$(echo "${{ vars.ECR_TARGET_ALLOCATOR_STAGING_REPO }}" | awk -F'/' '{print $NF}')"
- name: Echo test variables
run: |
echo "CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}"
echo "CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}"
echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}"
echo "ECR_INTEGRATION_TEST_REPO: ${{ steps.set-outputs.outputs.ECR_INTEGRATION_TEST_REPO }}"
echo "ECR_OPERATOR_REPO: ${{ steps.set-outputs.outputs.ECR_OPERATOR_REPO }}"
echo "ECR_TARGET_ALLOCATOR_REPO: ${{ steps.set-outputs.outputs.ECR_TARGET_ALLOCATOR_REPO }}"
RosaBaseTest:
needs: [ OutputEnvVariables,GenerateTestMatrix ]
name: 'Rosa Base Test'
uses: ./.github/workflows/e2e-rosa-test.yml
secrets: inherit
with:
terraform_dir: terraform/rosa/e2e
job_id: rosa-test
test_props: ${{ needs.GenerateTestMatrix.outputs.rosa_e2e_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 }}
cloudwatch_agent_repository: ${{ needs.OutputEnvVariables.outputs.ECR_INTEGRATION_TEST_REPO }}
cloudwatch_agent_tag: ${{ github.sha }}
cloudwatch_agent_operator_repository: ${{ needs.OutputEnvVariables.outputs.ECR_OPERATOR_REPO }}
cloudwatch_agent_operator_tag: ${{ needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha }}
region: ${{ inputs.region || 'us-east-1' }}
helm_charts_branch: ${{ inputs.helm-charts-branch || 'main' }}
terraform_assume_role: ${{vars.TERRAFORM_AWS_ASSUME_ROLE}}
agent_config: resources/cwagent_configs/jvm_tomcat.json
sample_app: resources/sample_apps/tomcat.yaml
GenerateTestMatrix:
# needs: [BuildAgent, BuildOperator]
name: 'GenerateTestMatrix'
runs-on: ubuntu-latest
outputs:
eks_e2e_jmx_matrix: ${{ steps.set-matrix.outputs.eks_e2e_jmx_matrix }}
rosa_e2e_matrix: ${{steps.set-matrix.outputs.rosa_e2e_matrix}}
steps:
- uses: actions/checkout@v3
with:
repository: ${{env.CWA_GITHUB_TEST_REPO_NAME}}
ref: ${{env.CWA_GITHUB_TEST_REPO_BRANCH}}
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.22.2
- name: Generate matrix
id: set-matrix
run: |
go run generator/test_case_generator.go -e2e
echo "::set-output name=eks_e2e_jmx_matrix::$(echo $(cat generator/resources/eks_e2e_jmx_complete_test_matrix.json))"
echo "::set-output name=rosa_e2e_matrix::$(echo $(cat generator/resources/rosa_e2e_cluster_complete_test_matrix.json))"
- name: Echo test plan matrix
run: |
echo "eks_e2e_jmx_matrix: ${{ steps.set-matrix.outputs.eks_e2e_jmx_matrix }}"
echo "rosa_e2e_matrix: ${{ steps.set-matrix.outputs.rosa_e2e_matrix }}"
# EKSE2EJVMTomcatTest:
# needs: [ GetLatestOperatorCommitSHA, GenerateTestMatrix, OutputEnvVariables ]
# name: 'EKSE2EJVMTomcatTest'
# uses: ./.github/workflows/eks-e2e-test.yml
# with:
# terraform_dir: terraform/eks/e2e
# job_id: eks-e2e-jvm-tomcat-test
# test_props: ${{ needs.GenerateTestMatrix.outputs.eks_e2e_jmx_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 }}
# cloudwatch_agent_repository: ${{ needs.OutputEnvVariables.outputs.ECR_INTEGRATION_TEST_REPO }}
# cloudwatch_agent_tag: ${{ github.sha }}
# cloudwatch_agent_operator_repository: ${{ needs.OutputEnvVariables.outputs.ECR_OPERATOR_REPO }}
# cloudwatch_agent_operator_tag: ${{ needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha }}
# region: ${{ inputs.region || 'us-west-2' }}
# helm_charts_branch: ${{ inputs.helm-charts-branch || 'main' }}
# terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
# agent_config: resources/cwagent_configs/jvm_tomcat.json
# sample_app: resources/sample_apps/tomcat.yaml
# secrets: inherit
#
# EKSE2EKafkaTest:
# needs: [ GetLatestOperatorCommitSHA, GenerateTestMatrix, OutputEnvVariables ]
# name: 'EKSE2EKafkaTest'
# uses: ./.github/workflows/eks-e2e-test.yml
# with:
# terraform_dir: terraform/eks/e2e
# job_id: eks-e2e-kafka-test
# test_props: ${{ needs.GenerateTestMatrix.outputs.eks_e2e_jmx_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 }}
# cloudwatch_agent_repository: ${{ needs.OutputEnvVariables.outputs.ECR_INTEGRATION_TEST_REPO }}
# cloudwatch_agent_tag: ${{ github.sha }}
# cloudwatch_agent_operator_repository: ${{ needs.OutputEnvVariables.outputs.ECR_OPERATOR_REPO }}
# cloudwatch_agent_operator_tag: ${{ needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha }}
# region: ${{ inputs.region || 'us-west-2' }}
# helm_charts_branch: ${{ inputs.helm-charts-branch || 'main' }}
# terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
# agent_config: resources/cwagent_configs/kafka.json
# sample_app: resources/sample_apps/kafka.yaml
# secrets: inherit
#
# EKSE2EJMXContainerInsightsTest:
# needs: [ GetLatestOperatorCommitSHA, GenerateTestMatrix, OutputEnvVariables ]
# name: 'EKSE2EJMXContainerInsightsTest'
# uses: ./.github/workflows/eks-e2e-test.yml
# with:
# terraform_dir: terraform/eks/e2e
# job_id: eks-e2e-jmx-containerinsights-test
# test_props: ${{ needs.GenerateTestMatrix.outputs.eks_e2e_jmx_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 }}
# cloudwatch_agent_repository: ${{ needs.OutputEnvVariables.outputs.ECR_INTEGRATION_TEST_REPO }}
# cloudwatch_agent_tag: ${{ github.sha }}
# cloudwatch_agent_operator_repository: ${{ needs.OutputEnvVariables.outputs.ECR_OPERATOR_REPO }}
# cloudwatch_agent_operator_tag: ${{ needs.GetLatestOperatorCommitSHA.outputs.operator_commit_sha }}
# region: ${{ inputs.region || 'us-west-2' }}
# helm_charts_branch: ${{ inputs.helm-charts-branch || 'main' }}
# terraform_assume_role: ${{ vars.TERRAFORM_AWS_ASSUME_ROLE }}
# agent_config: resources/cwagent_configs/containerinsights.json
# sample_app: resources/sample_apps/tomcat.yaml
# secrets: inherit