-
Notifications
You must be signed in to change notification settings - Fork 56
184 lines (160 loc) · 6.42 KB
/
e2e-tests-app-with-java-agent.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
name: End to End Tests with Java Agent in Sample App
on:
workflow_call:
inputs:
aws-region:
required: true
type: string
image_tag:
required: true
type: string
caller-workflow-name:
required: true
type: string
permissions:
id-token: write
contents: read
env:
# The precense of this env var is required. It is not redundant
AWS_DEFAULT_REGION: ${{ inputs.aws-region }}
jobs:
build_Images_For_Testing_Sample_App_With_Java_Agent:
runs-on: ubuntu-latest
steps:
- name: Checkout Java Instrumentation repository
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: Validate the checksums of Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- 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 agent and testing docker images with Gradle
uses: gradle/gradle-build-action@v3
with:
arguments: jib
env:
COMMIT_HASH: ${{ inputs.image_tag }}
- uses: codecov/codecov-action@v3
test_Spring_App_With_Java_Agent:
name: Test Spring App with AWS OTel Java agent
needs: [ build_Images_For_Testing_Sample_App_With_Java_Agent ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- 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: Run test containers
run: docker compose up --abort-on-container-exit
working-directory: .github/collector
env:
INSTANCE_ID: ${{ github.run_id }}-${{ github.run_number }}
LISTEN_ADDRESS: 0.0.0.0:8080
APP_IMAGE: public.ecr.aws/aws-otel-test/aws-otel-java-springboot:${{ inputs.image_tag }}
VALIDATOR_COMMAND: -c springboot-otel-trace-metric-validation.yml --endpoint http://app:8080 --metric-namespace aws-otel-integ-test -t ${{ github.run_id }}-${{ github.run_number }}
test_Spark_App_With_Java_Agent:
name: Test Spark App with AWS OTel Java agent
needs: [ build_Images_For_Testing_Sample_App_With_Java_Agent ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- 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: Run test containers
run: docker compose up --abort-on-container-exit
working-directory: .github/collector
env:
INSTANCE_ID: ${{ github.run_id }}-${{ github.run_number }}
LISTEN_ADDRESS: 0.0.0.0:4567
APP_IMAGE: public.ecr.aws/aws-otel-test/aws-otel-java-spark:${{ inputs.image_tag }}
VALIDATOR_COMMAND: -c spark-otel-trace-metric-validation.yml --endpoint http://app:4567 --metric-namespace aws-otel-integ-test -t ${{ github.run_id }}-${{ github.run_number }}
test_Spark_AWS_SDK_V1_App_With_Java_Agent:
name: Test Spark App (AWS SDK v1) with AWS OTel Java agent
needs: [ build_Images_For_Testing_Sample_App_With_Java_Agent ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- 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: Run test containers
run: docker compose up --abort-on-container-exit
working-directory: .github/collector
env:
INSTANCE_ID: ${{ github.run_id }}-${{ github.run_number }}
LISTEN_ADDRESS: 0.0.0.0:4567
APP_IMAGE: public.ecr.aws/aws-otel-test/aws-otel-java-spark-awssdkv1:${{ inputs.image_tag }}
VALIDATOR_COMMAND: -c spark-otel-trace-metric-validation.yml --endpoint http://app:4567 --metric-namespace aws-otel-integ-test -t ${{ github.run_id }}-${{ github.run_number }}
# publish status
publish-build-status:
needs: [ test_Spring_App_With_Java_Agent, test_Spark_App_With_Java_Agent, test_Spark_AWS_SDK_V1_App_With_Java_Agent ]
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.test_Spring_App_With_Java_Agent.result == 'success' &&
needs.test_Spark_App_With_Java_Agent.result == 'success' &&
needs.test_Spark_AWS_SDK_V1_App_With_Java_Agent.result == 'success' }}
region: us-east-1
secrets:
roleArn: ${{ secrets.METRICS_ROLE_ARN }}