Skip to content

Commit fea6024

Browse files
authored
Modify workflows to test on java17 (#911)
* Modify terraform script to accept runtime * Add java workflow * Move java and python to seperate yml * change workflow name to be explicit * bump go version in workflow * Use Random id * runtime java17 in script
1 parent f70c255 commit fea6024

File tree

21 files changed

+305
-129
lines changed

21 files changed

+305
-129
lines changed

.github/workflows/canary.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
submodules: recursive
6868
- uses: actions/setup-go@v5
6969
with:
70-
go-version: '~1.21.3'
70+
go-version: '~1.21.10'
7171
check-latest: true
7272
- uses: actions/setup-java@v4
7373
if: ${{ matrix.language == 'java' }}

.github/workflows/main-build-java.yml

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
name: Java Layer Integration Test
2+
on:
3+
workflow_call:
4+
inputs:
5+
caller-workflow-name:
6+
required: true
7+
type: string
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: main-build-java-${{ github.ref_name }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
id-token: write
16+
contents: read
17+
18+
jobs:
19+
integration-test:
20+
runs-on: ubuntu-20.04
21+
name: java-${{ matrix.sample-app }}-${{ matrix.instrumentation-type }}-${{ matrix.architecture }}-${{matrix.confmap}}
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
architecture: [ amd64, arm64 ]
26+
runtime: [java17, java11, java8.al2]
27+
sample-app: [ aws-sdk, okhttp ]
28+
instrumentation-type: [ wrapper ]
29+
confmap: [ "noop" ]
30+
include:
31+
- sample-app: aws-sdk
32+
instrumentation-type: agent
33+
architecture: amd64
34+
confmap: noop
35+
runtime: java17
36+
- sample-app: aws-sdk
37+
instrumentation-type: agent
38+
architecture: amd64
39+
confmap: noop
40+
runtime: java11
41+
- sample-app: aws-sdk
42+
instrumentation-type: agent
43+
architecture: amd64
44+
confmap: noop
45+
runtime: java8.al2
46+
- sample-app: aws-sdk
47+
instrumentation-type: agent
48+
architecture: arm64
49+
confmap: noop
50+
runtime: java17
51+
- sample-app: aws-sdk
52+
instrumentation-type: agent
53+
architecture: arm64
54+
confmap: noop
55+
runtime: java11
56+
- sample-app: aws-sdk
57+
instrumentation-type: agent
58+
architecture: arm64
59+
confmap: noop
60+
runtime: java8.al2
61+
- sample-app: aws-sdk
62+
instrumentation-type: agent-confmap
63+
architecture: amd64
64+
confmap: s3
65+
runtime: java11
66+
- sample-app: aws-sdk
67+
instrumentation-type: agent-confmap
68+
architecture: arm64
69+
confmap: s3
70+
runtime: java11
71+
- sample-app: aws-sdk
72+
instrumentation-type: agent-confmap
73+
architecture: amd64
74+
confmap: http
75+
runtime: java11
76+
- sample-app: aws-sdk
77+
instrumentation-type: agent-confmap
78+
architecture: arm64
79+
confmap: http
80+
runtime: java11
81+
- sample-app: aws-sdk
82+
instrumentation-type: agent-confmap
83+
architecture: amd64
84+
confmap: https
85+
runtime: java11
86+
- sample-app: aws-sdk
87+
instrumentation-type: agent-confmap
88+
architecture: arm64
89+
confmap: https
90+
runtime: java11
91+
92+
steps:
93+
- uses: actions/checkout@v4
94+
with:
95+
submodules: recursive
96+
- uses: actions/setup-go@v5
97+
with:
98+
go-version: '~1.21.10'
99+
check-latest: true
100+
- uses: actions/setup-java@v4
101+
with:
102+
distribution: corretto
103+
java-version: '17'
104+
- name: Cache (Java)
105+
uses: actions/cache@v3
106+
with:
107+
path: |
108+
~/go/pkg/mod
109+
~/.gradle/caches
110+
~/.gradle/wrapper
111+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}-go-${{ hashFiles('**/go.sum') }}
112+
restore-keys: |
113+
${{ runner.os }}-gradle-
114+
115+
- uses: aws-actions/[email protected]
116+
with:
117+
role-to-assume: ${{ secrets.INTEG_TEST_LAMBDA_ROLE_ARN }}
118+
role-duration-seconds: 7200
119+
aws-region: us-east-1
120+
- name: Generate UUID
121+
id: generate-uuid
122+
run: |
123+
UUID=$(uuidgen | cut -c1-4)
124+
echo "uuid=$UUID" >> $GITHUB_OUTPUT
125+
- name: Patch ADOT
126+
run: ./patch-upstream.sh
127+
- name: Build layers / functions
128+
run: GOARCH=${{ matrix.architecture }} ./build.sh ${{ matrix.architecture }}
129+
working-directory: java
130+
- name: Get Lambda Layer amd64 architecture value
131+
if: ${{ matrix.architecture == 'amd64' }}
132+
run: echo LAMBDA_FUNCTION_ARCH=x86_64 | tee --append $GITHUB_ENV
133+
- name: Get Lambda Layer arm64 architecture value
134+
if: ${{ matrix.architecture == 'arm64' }}
135+
run: echo LAMBDA_FUNCTION_ARCH=arm64 | tee --append $GITHUB_ENV
136+
- name: Get terraform directory
137+
run: |
138+
echo TERRAFORM_DIRECTORY=java/integration-tests/${{ matrix.sample-app }}/${{ matrix.instrumentation-type }} |
139+
tee --append $GITHUB_ENV
140+
- uses: hashicorp/setup-terraform@v2
141+
- name: Initialize terraform
142+
run: terraform init
143+
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
144+
- name: Get terraform Lambda function name
145+
run: |
146+
echo TERRAFORM_LAMBDA_FUNCTION_NAME=lambda-java-${{ matrix.sample-app }}-${{ matrix.instrumentation-type }}-${{ matrix.confmap }}-${{ matrix.architecture }}-${{ steps.generate-uuid.outputs.uuid }} |
147+
tee --append $GITHUB_ENV
148+
- name: Apply terraform
149+
run: terraform apply -auto-approve
150+
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
151+
env:
152+
TF_VAR_sdk_layer_name: opentelemetry-java-${{ matrix.sample-app }}-${{ matrix.instrumentation-type }}-${{ matrix.architecture }}-${{ github.run_id }}
153+
TF_VAR_function_name: ${{ env.TERRAFORM_LAMBDA_FUNCTION_NAME }}
154+
TF_VAR_architecture: ${{ env.LAMBDA_FUNCTION_ARCH }}
155+
TF_VAR_configuration_source: ${{ matrix.confmap }}
156+
TF_VAR_runtime: ${{ matrix.runtime }}
157+
- name: Extract endpoint
158+
id: extract-endpoint
159+
run: terraform output -raw api-gateway-url
160+
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
161+
- name: Extract AMP endpoint
162+
id: extract-amp-endpoint
163+
if: ${{ matrix.sample-app == 'aws-sdk' && startsWith(matrix.instrumentation-type, 'agent') }}
164+
run: terraform output -raw amp_endpoint
165+
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
166+
- name: Extract SDK layer arn
167+
id: extract-sdk-layer-arn
168+
run: terraform output -raw sdk_layer_arn
169+
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
170+
- name: Output annotations
171+
run: |
172+
echo "::warning::Function: ${{ env.TERRAFORM_LAMBDA_FUNCTION_NAME }}"
173+
echo "::warning::SDK Layer ARN: ${{ steps.extract-sdk-layer-arn.outputs.stdout }}"
174+
- name: Send request to endpoint
175+
run: curl -sS ${{ steps.extract-endpoint.outputs.stdout }}
176+
- name: Checkout test framework
177+
uses: actions/checkout@v4
178+
with:
179+
repository: aws-observability/aws-otel-test-framework
180+
path: test-framework
181+
- name: validate trace sample
182+
run: |
183+
cp adot/utils/expected-templates/java-${{ matrix.sample-app }}-${{ matrix.instrumentation-type }}.json \
184+
test-framework/validator/src/main/resources/expected-data-template/lambdaExpectedTrace.mustache
185+
cd test-framework
186+
./gradlew :validator:run --args="-c default-lambda-validation.yml --endpoint ${{ steps.extract-endpoint.outputs.stdout }} --region $AWS_REGION"
187+
- name: validate java agent metric sample
188+
if: ${{ matrix.sample-app == 'aws-sdk' && startsWith(matrix.instrumentation-type, 'agent') }}
189+
run: |
190+
cp adot/utils/expected-templates/java-${{ matrix.sample-app }}-${{ matrix.instrumentation-type }}-metric.json \
191+
test-framework/validator/src/main/resources/expected-data-template/ampExpectedMetric.mustache
192+
cd test-framework
193+
./gradlew :validator:run --args="-c prometheus-static-metric-validation.yml --cortex-instance-endpoint ${{ steps.extract-amp-endpoint.outputs.stdout }} --region $AWS_REGION"
194+
- name: Destroy terraform
195+
if: always()
196+
run: terraform destroy -auto-approve
197+
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
198+
env:
199+
TF_VAR_architecture: ${{ env.LAMBDA_FUNCTION_ARCH }}

.github/workflows/main-build-python311.yml renamed to .github/workflows/main-build-python.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,36 @@
1-
name: Python-3.11 Layer Integration Test
2-
# This workflow is for verifying python3.11 layer in Lambda python3.8 environment
1+
name: Python Layer Integration Test
32
on:
4-
push:
5-
branches:
6-
- main
7-
- release/*
8-
paths-ignore:
9-
- '.github/**'
10-
- '!.github/workflows/main-build-python311.yml'
11-
- '**.md'
3+
workflow_call:
4+
inputs:
5+
caller-workflow-name:
6+
required: true
7+
type: string
128
workflow_dispatch:
139

1410
concurrency:
15-
group: main-build-python311-${{ github.ref_name }}
11+
group: main-build-python-${{ github.ref_name }}
1612
cancel-in-progress: true
1713

18-
1914
permissions:
2015
id-token: write
16+
contents: read
2117

2218
jobs:
2319
integration-test:
2420
runs-on: ubuntu-20.04
25-
name: Python311-${{ matrix.architecture }}-IntegrationTest
21+
name: python-wrapper-${{ matrix.architecture }}
2622
strategy:
2723
fail-fast: false
2824
matrix:
2925
architecture: [ amd64, arm64 ]
26+
runtime: [python3.9, python3.10, python3.11]
3027
steps:
3128
- uses: actions/checkout@v4
3229
with:
3330
submodules: recursive
3431
- uses: actions/setup-go@v5
3532
with:
36-
go-version: '~1.21.3'
33+
go-version: '~1.21.10'
3734
check-latest: true
3835
- uses: actions/setup-python@v5
3936
with:
@@ -52,6 +49,11 @@ jobs:
5249
role-to-assume: ${{ secrets.INTEG_TEST_LAMBDA_ROLE_ARN }}
5350
role-duration-seconds: 7200
5451
aws-region: us-east-1
52+
- name: Generate UUID
53+
id: generate-uuid
54+
run: |
55+
UUID=$(uuidgen | cut -c1-4)
56+
echo "uuid=$UUID" >> $GITHUB_OUTPUT
5557
- name: Patch ADOT
5658
run: ./patch-upstream.sh
5759
- name: Login to Public ECR
@@ -77,7 +79,7 @@ jobs:
7779
working-directory: ${{ env.TERRAFORM_DIRECTORY }}
7880
- name: Get terraform Lambda function name
7981
run: |
80-
echo TERRAFORM_LAMBDA_FUNCTION_NAME=lambda-python-${{ matrix.architecture }}-${{ github.run_id }} |
82+
echo TERRAFORM_LAMBDA_FUNCTION_NAME=lambda-python-${{ matrix.architecture }}-${{ steps.generate-uuid.outputs.uuid }} |
8183
tee --append $GITHUB_ENV
8284
- name: Apply terraform
8385
run: terraform apply -auto-approve
@@ -86,7 +88,7 @@ jobs:
8688
TF_VAR_sdk_layer_name: opentelemetry-python-aws-sdk-wrapper-${{ matrix.architecture }}
8789
TF_VAR_function_name: ${{ env.TERRAFORM_LAMBDA_FUNCTION_NAME }}
8890
TF_VAR_architecture: ${{ env.LAMBDA_FUNCTION_ARCH }}
89-
TF_VAR_runtime: 'python3.11'
91+
TF_VAR_runtime: ${{ matrix.runtime }}
9092
- name: Extract endpoint
9193
id: extract-endpoint
9294
run: terraform output -raw api-gateway-url

0 commit comments

Comments
 (0)