Skip to content

Commit dbddcd7

Browse files
integration-test workflow updates (#4977)
1 parent 55093a0 commit dbddcd7

File tree

2 files changed

+120
-23
lines changed

2 files changed

+120
-23
lines changed

.github/workflows/integration-test.yml

Lines changed: 119 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,31 @@ jobs:
5454
name: agent-bundle-linux-${{ matrix.ARCH }}
5555
path: ./dist/agent-bundle_linux_${{ matrix.ARCH }}.tar.gz
5656

57+
otelcol:
58+
runs-on: ubuntu-20.04
59+
strategy:
60+
matrix:
61+
ARCH: [ "amd64", "arm64", "ppc64le" ]
62+
steps:
63+
- uses: actions/checkout@v4
64+
with:
65+
fetch-depth: 0
66+
- uses: actions/setup-go@v5
67+
with:
68+
go-version: ${{ env.GO_VERSION }}
69+
cache-dependency-path: '**/go.sum'
70+
- run: make binaries-linux_${{ matrix.ARCH }}
71+
- uses: actions/upload-artifact@v4
72+
with:
73+
name: otelcol-${{ matrix.ARCH }}
74+
path: |
75+
./bin/*
76+
5777
docker-otelcol:
5878
name: docker-otelcol
5979
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved
6080
runs-on: ubuntu-20.04
61-
needs: agent-bundle-linux
81+
needs: [ "agent-bundle-linux", "otelcol" ]
6282
services:
6383
# Start a local registry for pushing the multiarch manifest and images
6484
registry:
@@ -77,12 +97,14 @@ jobs:
7797
cache-dependency-path: '**/go.sum'
7898
- uses: actions/download-artifact@v4
7999
with:
80-
name: agent-bundle-linux-amd64
100+
pattern: agent-bundle-linux-*
101+
merge-multiple: true
81102
path: ./dist
82103
- uses: actions/download-artifact@v4
83104
with:
84-
name: agent-bundle-linux-arm64
85-
path: ./dist
105+
pattern: otelcol-*
106+
merge-multiple: true
107+
path: ./bin
86108
- uses: docker/setup-qemu-action@v3
87109
with:
88110
platforms: arm64,ppc64le
@@ -92,7 +114,7 @@ jobs:
92114
with:
93115
driver: docker-container # Create a builder with the docker-container driver required for multiarch builds
94116
driver-opts: network=host # Required for the builder to push to the local registry service
95-
- run: make docker-otelcol SKIP_BUNDLE=true ARCH=amd64,arm64,ppc64le IMAGE_NAME=localhost:5000/otelcol IMAGE_TAG=latest PUSH=true
117+
- run: make docker-otelcol SKIP_COMPILE=true SKIP_BUNDLE=true ARCH=amd64,arm64,ppc64le IMAGE_NAME=localhost:5000/otelcol IMAGE_TAG=latest PUSH=true
96118
env:
97119
MULTIARCH_OTELCOL_BUILDER: ${{ steps.multiarch-otelcol-builder.outputs.name }} # Use the builder created by the docker/setup-buildx-action step
98120
- name: Save image archive for each platform to be loaded by downstream jobs
@@ -104,10 +126,6 @@ jobs:
104126
docker save -o ./docker-otelcol/${arch}/image.tar otelcol:latest
105127
docker rmi -f localhost:5000/otelcol:latest otelcol:latest
106128
done
107-
- uses: actions/upload-artifact@v4
108-
with:
109-
name: otelcol
110-
path: ./bin
111129
- uses: actions/upload-artifact@v4
112130
with:
113131
name: docker-otelcol-amd64
@@ -129,7 +147,7 @@ jobs:
129147
matrix:
130148
ARCH: [ "amd64", "arm64" ]
131149
fail-fast: false
132-
needs: [docker-otelcol]
150+
needs: [ "docker-otelcol", "otelcol" ]
133151
steps:
134152
- uses: actions/checkout@v4
135153
with:
@@ -140,7 +158,7 @@ jobs:
140158
cache-dependency-path: '**/go.sum'
141159
- uses: actions/download-artifact@v4
142160
with:
143-
name: otelcol
161+
name: otelcol-${{ matrix.ARCH }}
144162
path: ./bin
145163
- uses: actions/download-artifact@v4
146164
with:
@@ -158,25 +176,26 @@ jobs:
158176
env:
159177
SPLUNK_OTEL_COLLECTOR_IMAGE: 'otelcol:latest'
160178

161-
integration-test:
162-
name: integration-test
179+
integration-test-docker:
163180
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved
164181
runs-on: ubuntu-20.04
165-
needs: [docker-otelcol]
182+
needs: [ "docker-otelcol", "otelcol" ]
166183
strategy:
167184
matrix:
168185
ARCH: [ "amd64", "arm64" ]
169186
PROFILE: [ "integration", "smartagent" ]
170187
fail-fast: false
188+
env:
189+
TEST_OUTPUT: ${{ github.job }}-${{ matrix.PROFILE }}-${{ matrix.ARCH }}.out
171190
steps:
172191
- uses: actions/checkout@v4
173192
with:
174193
fetch-depth: 0
175194
- name: Build ${{ matrix.PROFILE }} service images
176195
run: |
177-
images=$(yq '.services[] | select(.profiles[] | contains("${{ matrix.PROFILE }}")) | .image' docker/docker-compose.yml | grep "quay.io/splunko11ytest/" | sort -u)
196+
images=$(yq '.services[] | select(.profiles[] | . == "${{ matrix.PROFILE }}") | .image' docker/docker-compose.yml | grep "quay.io/splunko11ytest/" | sort -u)
178197
for image in $images; do
179-
service=$(echo $image | sed 's|quay.io/splunko11ytest/\(.*\):latest|\1|')
198+
service=$(basename "$image" | cut -d ':' -f1)
180199
if [[ -f docker/${service}/Dockerfile ]]; then
181200
docker build --cache-from=quay.io/splunko11ytest/${service}:latest -t quay.io/splunko11ytest/${service}:latest docker/${service}
182201
fi
@@ -191,7 +210,7 @@ jobs:
191210
cache-dependency-path: '**/go.sum'
192211
- uses: actions/download-artifact@v4
193212
with:
194-
name: otelcol
213+
name: otelcol-${{ matrix.ARCH }}
195214
path: ./bin
196215
- uses: actions/download-artifact@v4
197216
with:
@@ -221,7 +240,7 @@ jobs:
221240
if [[ "${{ matrix.PROFILE }}" = "smartagent" ]]; then
222241
target="smartagent-integration-test"
223242
fi
224-
make $target 2>&1 | tee ${{ matrix.PROFILE }}-${{ github.run_id }}-${{ matrix.ARCH }}.out
243+
make $target 2>&1 | tee $TEST_OUTPUT
225244
exit_status=${PIPESTATUS[0]}
226245
echo "Exit status: $exit_status"
227246
exit $exit_status
@@ -232,8 +251,85 @@ jobs:
232251
uses: actions/upload-artifact@v4
233252
if: always()
234253
with:
235-
name: ${{ matrix.PROFILE }}-${{ github.run_id }}-${{ matrix.ARCH }}.out
236-
path: ${{ matrix.PROFILE }}-${{ github.run_id }}-${{ matrix.ARCH }}.out
254+
name: ${{ env.TEST_OUTPUT }}
255+
path: ${{ env.TEST_OUTPUT }}
256+
retention-days: 5
257+
258+
integration-test-binary:
259+
runs-on: ${{ matrix.RUNNER }}
260+
needs: [ "agent-bundle-linux", "otelcol" ]
261+
strategy:
262+
matrix:
263+
RUNNER: [ "ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04" ]
264+
PROFILE: [ "integration", "smartagent" ]
265+
fail-fast: false
266+
env:
267+
TEST_OUTPUT: ${{ github.job }}-${{ matrix.PROFILE }}-${{ matrix.RUNNER }}.out
268+
steps:
269+
- uses: actions/checkout@v4
270+
with:
271+
fetch-depth: 0
272+
- name: Build ${{ matrix.PROFILE }} service images
273+
run: |
274+
images=$(yq '.services[] | select(.profiles[] | . == "${{ matrix.PROFILE }}") | .image' docker/docker-compose.yml | grep "quay.io/splunko11ytest/" | sort -u)
275+
for image in $images; do
276+
service=$(basename "$image" | cut -d ':' -f1)
277+
if [[ -f docker/${service}/Dockerfile ]]; then
278+
docker build --cache-from=quay.io/splunko11ytest/${service}:latest -t quay.io/splunko11ytest/${service}:latest docker/${service}
279+
fi
280+
done
281+
docker system prune -f
282+
docker builder prune -f
283+
docker images
284+
- run: docker compose -f docker/docker-compose.yml --profile ${{ matrix.PROFILE }} up -d --quiet-pull
285+
- uses: actions/setup-go@v5
286+
with:
287+
go-version: ${{ env.GO_VERSION }}
288+
cache-dependency-path: '**/go.sum'
289+
- uses: actions/download-artifact@v4
290+
with:
291+
pattern: agent-bundle-linux-amd64
292+
merge-multiple: true
293+
path: ./dist
294+
- run: sudo mkdir -p /usr/lib/splunk-otel-collector
295+
- run: sudo tar -xzf dist/agent-bundle_linux_amd64.tar.gz -C /usr/lib/splunk-otel-collector
296+
- run: sudo chown -R $USER /usr/lib/splunk-otel-collector
297+
- run: /usr/lib/splunk-otel-collector/agent-bundle/bin/patch-interpreter /usr/lib/splunk-otel-collector/agent-bundle
298+
- uses: actions/download-artifact@v4
299+
with:
300+
name: otelcol-amd64
301+
path: ./bin
302+
- run: ln -sf otelcol_linux_amd64 ./bin/otelcol
303+
- run: chmod a+x ./bin/*
304+
- uses: shogo82148/actions-setup-redis@v1
305+
if: matrix.PROFILE == 'integration'
306+
with:
307+
auto-start: false
308+
redis-port: "6379"
309+
- run: redis-cli ping
310+
if: matrix.PROFILE == 'integration'
311+
- run: redis-cli set tempkey tempvalue
312+
if: matrix.PROFILE == 'integration'
313+
- name: Run Integration Test
314+
run: |
315+
set -o pipefail
316+
target="integration-test"
317+
if [[ "${{ matrix.PROFILE }}" = "smartagent" ]]; then
318+
target="smartagent-integration-test"
319+
fi
320+
make $target 2>&1 | tee $TEST_OUTPUT
321+
exit_status=${PIPESTATUS[0]}
322+
echo "Exit status: $exit_status"
323+
exit $exit_status
324+
env:
325+
SPLUNK_OTEL_COLLECTOR_IMAGE: ""
326+
# The Integration Test output is extremely large so we upload it as an artifact
327+
- name: Upload Integration Test Output as Artifact
328+
uses: actions/upload-artifact@v4
329+
if: always()
330+
with:
331+
name: ${{ env.TEST_OUTPUT }}
332+
path: ${{ env.TEST_OUTPUT }}
237333
retention-days: 5
238334

239335
integration-test-mongodb-discovery:
@@ -258,7 +354,7 @@ jobs:
258354
cache-dependency-path: '**/go.sum'
259355
- uses: actions/download-artifact@v4
260356
with:
261-
name: otelcol
357+
name: otelcol-${{ matrix.ARCH }}
262358
path: ./bin
263359
- uses: actions/download-artifact@v4
264360
with:
@@ -282,6 +378,7 @@ jobs:
282378
exit $exit_status
283379
env:
284380
SPLUNK_OTEL_COLLECTOR_IMAGE: 'otelcol:latest'
381+
285382
integration-test-kafkametrics-discovery:
286383
name: integration-test-kafkametrics-discovery
287384
runs-on: ubuntu-22.04
@@ -301,7 +398,7 @@ jobs:
301398
cache-dependency-path: '**/go.sum'
302399
- uses: actions/download-artifact@v4
303400
with:
304-
name: otelcol
401+
name: otelcol-${{ matrix.ARCH }}
305402
path: ./bin
306403
- uses: actions/download-artifact@v4
307404
with:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
resource_logs:
22
- scope_logs:
33
- logs:
4-
- body: <RE2(Device\s+r/s\s+rkB/s\s+rrqm/s\s+%rrqm\s+r_await\s+rareq-sz\s+w/s\s+wkB/s\s+wrqm/s\s+%wrqm\s+w_await\s+wareq-sz\s+d/s\s+dkB/s\s+drqm/s\s+%drqm\s+d_await\s+dareq-sz\s+aqu-sz\s+%util)>
4+
- body: <RE2(Device\s+r/s\s+rkB/s\s+rrqm/s\s+%rrqm\s+r_await\s+rareq-sz\s+w/s\s+wkB/s\s+wrqm/s\s+%wrqm\s+w_await\s+wareq-sz\s+d/s\s+dkB/s\s+drqm/s\s+%drqm\s+d_await\s+dareq-sz\s+(f/s\s+)?(f_await\s+)?aqu-sz\s+%util)>

0 commit comments

Comments
 (0)