-
Notifications
You must be signed in to change notification settings - Fork 57
212 lines (185 loc) · 6.67 KB
/
e2e-tests-with-operator.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
name: End to End Tests with Operator
on:
workflow_call:
inputs:
aws-region:
required: true
type: string
image_tag:
required: true
type: string
image_uri:
required: true
type: string
test_ref:
required: true
type: string
caller-workflow-name:
required: true
type: string
env:
TESTING_FRAMEWORK_REPO: aws-observability/aws-otel-test-framework
NUM_BATCHES: 2
DDB_TABLE_NAME: BatchTestCache
# The precense of this env var is required. It is not redundant
AWS_DEFAULT_REGION: ${{ inputs.aws-region }}
permissions:
id-token: write
contents: read
jobs:
# job to build testbatches for e2e integration test
build-sample-app:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
# cache local patch outputs
- name: Cache local Maven repository
id: cache-local-maven-repo
uses: actions/cache@v3
with:
path: |
~/.m2/repository/io/opentelemetry/
key: ${{ runner.os }}-maven-local-${{ hashFiles('.github/patches/opentelemetry-java*.patch') }}
- name: Publish patched dependencies to maven local
uses: ./.github/actions/patch-dependencies
if: steps.cache-local-maven-repo.outputs.cache-hit != 'true'
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_password: ${{ secrets.GPG_PASSPHRASE }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Log in to AWS ECR
uses: docker/login-action@v3
with:
registry: public.ecr.aws
- name: Build and push Sample-Apps without Auto-Instrumentation Agent
uses: gradle/gradle-build-action@v3
with:
arguments: jibBuildWithoutAgent
env:
COMMIT_HASH: ${{ inputs.image_tag }}
get-testing-suites:
runs-on: ubuntu-latest
outputs:
test-case-batch-key: ${{ steps.set-batches.outputs.batch-keys }}
test-case-batch-value: ${{ steps.set-batches.outputs.batch-values }}
steps:
- name: Checkout Testing Framework repository
uses: actions/checkout@v4
with:
repository: ${{ env.TESTING_FRAMEWORK_REPO }}
path: testing-framework
ref: ${{ inputs.test_ref }}
- name: Checkout Java Instrumentation repository
uses: actions/checkout@v4
with:
fetch-depth: 0
path: aws-otel-java-instrumentation
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: '~1.18.9'
- name: Create test batch key values
id: set-batches
working-directory: testing-framework/tools/batchTestGenerator
run: |
go build
./batchTestGenerator github --testCaseFilePath=$GITHUB_WORKSPACE/aws-otel-java-instrumentation/.github/workflows/testcases.json --maxBatch=${{ env.NUM_BATCHES }} \
--include=EKS_ADOT_OPERATOR,EKS_ADOT_OPERATOR_ARM64
- name: List testing suites
run: |
echo ${{ steps.set-batches.outputs.batch-keys }}
echo ${{ steps.set-batches.outputs.batch-values }}
# job to run the e2e integration tests
run-batch-job:
runs-on: ubuntu-latest
needs: [ build-sample-app, get-testing-suites ]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.get-testing-suites.outputs.test-case-batch-key) }}
steps:
# required for versioning
- name: Checkout Java Instrumentation repository
uses: actions/checkout@v4
with:
fetch-depth: 0
path: aws-otel-java-instrumentation
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'
- name: Set up terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "~1.5"
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.JAVA_INSTRUMENTATION_INTEG_TEST_ARN}}
aws-region: us-west-2
# 4 hours
role-duration-seconds: 14400
- name: Checkout Testing Framework repository
uses: actions/checkout@v4
with:
repository: ${{ env.TESTING_FRAMEWORK_REPO }}
path: testing-framework
ref: ${{ inputs.test_ref }}
- name: create test-case-batch file
run: |
jsonStr='${{ needs.get-testing-suites.outputs.test-case-batch-value }}'
jsonStr="$(jq -r '.${{ matrix.BatchKey }} | join("\n")' <<< "${jsonStr}")"
echo "$jsonStr" >> testing-framework/terraform/test-case-batch
cat testing-framework/terraform/test-case-batch
- name: Get TTL_DATE for cache
id: date
run: echo "ttldate=$(date -u -d "+7 days" +%s)" >> $GITHUB_OUTPUT
- name: run tests
working-directory: testing-framework/terraform
run: |
export TTL_DATE=${{ steps.date.outputs.ttldate }}
export TF_VAR_java_auto_instrumentation_tag=${{ inputs.image_tag }}
export TF_VAR_java_auto_instrumentation_repository="${{ inputs.image_uri }}"
export DDB_BATCH_CACHE_SK=${{ inputs.image_tag }}
make execute-batch-test
- name: output cache misses
if: ${{ failure() }}
working-directory: testing-framework/terraform
run: |
export DDB_BATCH_CACHE_SK=${{ inputs.image_tag }}
make checkCacheHits
# This is here just in case workflow cancel
# We first kill terraform processes to ensure that no state
# file locks are being held from SIGTERMS dispatched in previous
# steps.
- name: Destroy resources
if: ${{ cancelled() || failure() }}
shell: bash {0}
working-directory: testing-framework/terraform
run: |
ps -ef | grep terraform | grep -v grep | awk '{print $2}' | xargs -n 1 kill
make terraformCleanup
# publish status
publish-build-status:
needs: [ run-batch-job ]
if: ${{ always() }}
uses: ./.github/workflows/publish-status.yml
with:
namespace: 'ADOT/GitHubActions'
repository: ${{ github.repository }}
branch: ${{ github.ref_name }}
workflow: ${{ inputs.caller-workflow-name }}
success: ${{ needs.run-batch-job.result == 'success' }}
region: us-east-1
secrets:
roleArn: ${{ secrets.METRICS_ROLE_ARN }}