Skip to content

Commit c2c2324

Browse files
authored
Integration Testing and Release workflow for ADOT Java AutoInstrumentation Image (includes cp-utility) (#358)
* Release workflow
1 parent d5203e3 commit c2c2324

File tree

6 files changed

+123
-10
lines changed

6 files changed

+123
-10
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# Enable debug mode, fail on any command that fail in this script and fail on unset variables
3+
set -x -e -u
4+
5+
TEST_TAG=$1
6+
ADOT_JAVA_VERSION=$2
7+
8+
docker volume create operator-volume
9+
docker run --mount source=operator-volume,dst=/otel-auto-instrumentation ${TEST_TAG} cp /javaagent.jar /otel-auto-instrumentation/javaagent.jar
10+
docker run -dt --mount source=operator-volume,dst=/otel-auto-instrumentation --name temp public.ecr.aws/amazonlinux/amazonlinux:latest
11+
FILENAME=$(docker exec temp /bin/bash -c "ls /otel-auto-instrumentation")
12+
if [ $FILENAME = javaagent.jar ]; then
13+
echo "javaagent.jar file was copied to the operator-volume"
14+
else
15+
echo "error: javaagent.jar file was not copied to the operator-volume"
16+
exit 1;
17+
fi
18+
19+
ORIG_CHECKSUM=$(sha256sum otelagent/build/libs/aws-opentelemetry-agent-${ADOT_JAVA_VERSION}.jar | cut -d' ' -f1)
20+
CHECKSUM=$(docker exec temp /bin/bash -c "sha256sum /otel-auto-instrumentation/javaagent.jar | cut -d' ' -f1")
21+
if [ $CHECKSUM = $ORIG_CHECKSUM ]; then
22+
echo "copied javaagent.jar checksum matched"
23+
else
24+
echo "error: copied javaagent.jar checksum mis-matched"
25+
exit 1;
26+
fi

.github/workflows/main-build.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- "release/v*"
77
env:
88
AWS_DEFAULT_REGION: us-east-1
9+
TEST_TAG: public.ecr.aws/aws-observability/adot-autoinstrumentation-java:test
910

1011
permissions:
1112
id-token: write
@@ -69,30 +70,38 @@ jobs:
6970
PUBLISH_PASSWORD: ${{ secrets.PUBLISH_PASSWORD }}
7071
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
7172
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
73+
7274
- name: Get current version
7375
shell: bash
7476
run: |
75-
echo ADOT_JAVA_VERSION="$(./gradlew printVersion -q )" >> $GITHUB_ENV
77+
echo "ADOT_JAVA_VERSION=$(./gradlew printVersion -q )" >> $GITHUB_ENV
7678
7779
- name: Set up QEMU
7880
uses: docker/setup-qemu-action@v2
7981

8082
- name: Set up Docker Buildx
8183
uses: docker/setup-buildx-action@v2
8284

83-
- name: Build image
85+
- name: Build image for testing
8486
uses: docker/build-push-action@v4
8587
with:
8688
push: false
8789
build-args: "ADOT_JAVA_VERSION=${{ env.ADOT_JAVA_VERSION }}"
8890
context: .
89-
platforms: linux/amd64,linux/arm64
91+
platforms: linux/amd64
92+
tags: ${{ env.TEST_TAG }}
93+
load: true
94+
95+
- name: Test docker image
96+
shell: bash
97+
run: .github/scripts/test-adot-javaagent-image.sh "${{ env.TEST_TAG }}" "${{ env.ADOT_JAVA_VERSION }}"
9098

9199
- name: Upload to GitHub Actions
92100
uses: actions/upload-artifact@v2
93101
with:
94102
name: aws-opentelemetry-agent.jar
95103
path: otelagent/build/libs/aws-opentelemetry-agent-*.jar
104+
96105
- name: Build and push agent and testing docker images with Gradle
97106
uses: gradle/gradle-build-action@v2
98107
with:

.github/workflows/nightly-upstream-snapshot-build.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66

77
env:
88
AWS_DEFAULT_REGION: us-east-1
9+
TEST_TAG: public.ecr.aws/aws-observability/adot-autoinstrumentation-java:test
910

1011
permissions:
1112
id-token: write
@@ -45,27 +46,34 @@ jobs:
4546
- name: Get current version
4647
shell: bash
4748
run: |
48-
echo ADOT_JAVA_VERSION="$(./gradlew printVersion -q -PtestUpstreamSnapshots=true )" >> $GITHUB_ENV
49+
echo "ADOT_JAVA_VERSION=$(./gradlew printVersion -q -PtestUpstreamSnapshots=true )" >> $GITHUB_ENV
4950
5051
- name: Set up QEMU
5152
uses: docker/setup-qemu-action@v2
5253

5354
- name: Set up Docker Buildx
5455
uses: docker/setup-buildx-action@v2
5556

56-
- name: Build image
57+
- name: Build image for testing
5758
uses: docker/build-push-action@v4
5859
with:
5960
push: false
6061
build-args: "ADOT_JAVA_VERSION=${{ env.ADOT_JAVA_VERSION }}"
6162
context: .
62-
platforms: linux/amd64,linux/arm64
63+
platforms: linux/amd64
64+
tags: ${{ env.TEST_TAG }}
65+
load: true
66+
67+
- name: Test docker image
68+
shell: bash
69+
run: .github/scripts/test-adot-javaagent-image.sh "${{ env.TEST_TAG }}" "${{ env.ADOT_JAVA_VERSION }}"
6370

6471
- name: Upload to GitHub Actions
6572
uses: actions/upload-artifact@v2
6673
with:
6774
name: aws-opentelemetry-agent.jar
6875
path: otelagent/build/libs/aws-opentelemetry-agent-*.jar
76+
6977
publish-build-status:
7078
needs: [build]
7179
if: ${{ always() }}
@@ -79,4 +87,3 @@ jobs:
7987
region: us-west-2
8088
secrets:
8189
roleArn: ${{ secrets.METRICS_ROLE_ARN }}
82-

.github/workflows/patch-release-build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212

1313
env:
1414
AWS_DEFAULT_REGION: us-east-1
15+
TEST_TAG: public.ecr.aws/aws-observability/adot-autoinstrumentation-java:test
1516

1617
permissions:
1718
id-token: write
@@ -99,6 +100,36 @@ jobs:
99100
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
100101
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
101102

103+
- name: Set up QEMU
104+
uses: docker/setup-qemu-action@v2
105+
106+
- name: Set up Docker Buildx
107+
uses: docker/setup-buildx-action@v2
108+
109+
- name: Build image for testing
110+
uses: docker/build-push-action@v4
111+
with:
112+
push: false
113+
build-args: "ADOT_JAVA_VERSION=${{ github.event.inputs.version }}"
114+
context: .
115+
platforms: linux/amd64
116+
tags: ${{ env.TEST_TAG }}
117+
load: true
118+
119+
- name: Test docker image
120+
shell: bash
121+
run: .github/scripts/test-adot-javaagent-image.sh "${{ env.TEST_TAG }}" "${{ github.event.inputs.version }}"
122+
123+
- name: Build and push image
124+
uses: docker/build-push-action@v4
125+
with:
126+
push: true
127+
build-args: "ADOT_JAVA_VERSION=${{ github.event.inputs.version }}"
128+
context: .
129+
platforms: linux/amd64,linux/arm64
130+
tags: |
131+
public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v${{ github.event.inputs.version }}, public.ecr.aws/aws-observability/adot-autoinstrumentation-java:latest
132+
102133
- name: Create Release
103134
id: create_release
104135
uses: actions/create-release@v1

.github/workflows/pr-build.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
branches:
55
- main
66
- "release/v*"
7+
env:
8+
TEST_TAG: public.ecr.aws/aws-observability/adot-autoinstrumentation-java:test
79

810
jobs:
911
testpatch:
@@ -71,7 +73,7 @@ jobs:
7173
if: ${{ matrix.os == 'ubuntu-latest' }}
7274
shell: bash
7375
run: |
74-
echo ADOT_JAVA_VERSION="$(./gradlew printVersion -q )" >> $GITHUB_ENV
76+
echo "ADOT_JAVA_VERSION=$(./gradlew printVersion -q )" >> $GITHUB_ENV
7577
7678
- name: Set up QEMU
7779
uses: docker/setup-qemu-action@v2
@@ -81,14 +83,21 @@ jobs:
8183
uses: docker/setup-buildx-action@v2
8284
if: ${{ matrix.os == 'ubuntu-latest' }}
8385

84-
- name: Build image
86+
- name: Build image for testing
8587
uses: docker/build-push-action@v4
8688
if: ${{ matrix.os == 'ubuntu-latest' }}
8789
with:
8890
push: false
8991
build-args: "ADOT_JAVA_VERSION=${{ env.ADOT_JAVA_VERSION }}"
9092
context: .
91-
platforms: linux/amd64,linux/arm64
93+
platforms: linux/amd64
94+
tags: ${{ env.TEST_TAG }}
95+
load: true
96+
97+
- name: Test docker image
98+
if: ${{ matrix.os == 'ubuntu-latest' }}
99+
shell: bash
100+
run: .github/scripts/test-adot-javaagent-image.sh "${{ env.TEST_TAG }}" "${{ env.ADOT_JAVA_VERSION }}"
92101

93102
- name: Build with Gradle
94103
uses: gradle/gradle-build-action@v2

.github/workflows/release-build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
env:
1010
AWS_DEFAULT_REGION: us-east-1
11+
TEST_TAG: public.ecr.aws/aws-observability/adot-autoinstrumentation-java:test
1112

1213
permissions:
1314
id-token: write
@@ -52,6 +53,36 @@ jobs:
5253
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
5354
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
5455

56+
- name: Set up QEMU
57+
uses: docker/setup-qemu-action@v2
58+
59+
- name: Set up Docker Buildx
60+
uses: docker/setup-buildx-action@v2
61+
62+
- name: Build image for testing
63+
uses: docker/build-push-action@v4
64+
with:
65+
push: false
66+
build-args: "ADOT_JAVA_VERSION=${{ github.event.inputs.version }}"
67+
context: .
68+
platforms: linux/amd64
69+
tags: ${{ env.TEST_TAG }}
70+
load: true
71+
72+
- name: Test docker image
73+
shell: bash
74+
run: .github/scripts/test-adot-javaagent-image.sh "${{ env.TEST_TAG }}" "${{ github.event.inputs.version }}"
75+
76+
- name: Build and push image
77+
uses: docker/build-push-action@v4
78+
with:
79+
push: true
80+
build-args: "ADOT_JAVA_VERSION=${{ github.event.inputs.version }}"
81+
context: .
82+
platforms: linux/amd64,linux/arm64
83+
tags: |
84+
public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v${{ github.event.inputs.version }}, public.ecr.aws/aws-observability/adot-autoinstrumentation-java:latest
85+
5586
- name: Create Release
5687
id: create_release
5788
uses: actions/create-release@v1

0 commit comments

Comments
 (0)