forked from signalfx/splunk-otel-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
394 lines (384 loc) · 14.5 KB
/
integration-test.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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
name: "Integration Test"
on:
push:
branches:
- main
pull_request:
paths:
- '.github/workflows/integration-test.yml'
- 'cmd/**'
- 'docker/**'
- 'internal/**'
- 'packaging/bundle/**'
- 'instrumentation/packaging/**'
- 'pkg/**'
- 'tests/**'
- 'Makefile'
- 'Makefile.Common'
- 'go.mod'
- 'go.sum'
- 'packaging/jmx-metric-gatherer-release.txt'
- '!**.md'
- '!packaging/technical-addon/**'
concurrency:
group: integration-test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GO_VERSION: "1.22.7"
jobs:
agent-bundle-linux:
runs-on: ${{ fromJSON('["ubuntu-24.04", "otel-arm64"]')[matrix.ARCH == 'arm64'] }}
strategy:
matrix:
ARCH: [ "amd64", "arm64" ]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: bundle-cache
with:
path: .cache/buildx/agent-bundle-${{ matrix.ARCH }}
key: agent-bundle-buildx-${{ matrix.ARCH }}-${{ hashFiles('packaging/bundle/**') }}
restore-keys: |
agent-bundle-buildx-${{ matrix.ARCH }}-
- run: make -C packaging/bundle agent-bundle-linux ARCH=${{ matrix.ARCH }}
env:
BUNDLE_CACHE_HIT: "${{ steps.bundle-cache.outputs.cache-hit }}"
- uses: actions/upload-artifact@v4
with:
name: agent-bundle-linux-${{ matrix.ARCH }}
path: ./dist/agent-bundle_linux_${{ matrix.ARCH }}.tar.gz
otelcol:
runs-on: ubuntu-24.04
strategy:
matrix:
ARCH: [ "amd64", "arm64", "ppc64le" ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- run: make binaries-linux_${{ matrix.ARCH }}
- uses: actions/upload-artifact@v4
with:
name: otelcol-${{ matrix.ARCH }}
path: |
./bin/*
docker-otelcol:
name: docker-otelcol
runs-on: ubuntu-24.04
needs: [ "agent-bundle-linux", "otelcol" ]
services:
# Start a local registry for pushing the multiarch manifest and images
registry:
image: registry:2
ports:
- 5000:5000
steps:
# Multiarch images require more disk space
- uses: jlumbroso/free-disk-space@v1.3.1
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- uses: actions/download-artifact@v4
with:
pattern: agent-bundle-linux-*
merge-multiple: true
path: ./dist
- uses: actions/download-artifact@v4
with:
pattern: otelcol-*
merge-multiple: true
path: ./bin
- uses: docker/setup-qemu-action@v3
with:
platforms: arm64,ppc64le
image: tonistiigi/binfmt:qemu-v7.0.0
- uses: docker/setup-buildx-action@v3
id: multiarch-otelcol-builder
with:
driver: docker-container # Create a builder with the docker-container driver required for multiarch builds
driver-opts: network=host # Required for the builder to push to the local registry service
- run: make docker-otelcol SKIP_COMPILE=true SKIP_BUNDLE=true ARCH=amd64,arm64,ppc64le IMAGE_NAME=localhost:5000/otelcol IMAGE_TAG=latest PUSH=true
env:
MULTIARCH_OTELCOL_BUILDER: ${{ steps.multiarch-otelcol-builder.outputs.name }} # Use the builder created by the docker/setup-buildx-action step
- name: Save image archive for each platform to be loaded by downstream jobs
run: |
for arch in "amd64" "arm64" "ppc64le"; do
mkdir -p docker-otelcol/${arch}
docker pull --platform=linux/${arch} localhost:5000/otelcol:latest
docker tag localhost:5000/otelcol:latest otelcol:latest
docker save -o ./docker-otelcol/${arch}/image.tar otelcol:latest
docker rmi -f localhost:5000/otelcol:latest otelcol:latest
done
- uses: actions/upload-artifact@v4
with:
name: docker-otelcol-amd64
path: ./docker-otelcol/amd64
- uses: actions/upload-artifact@v4
with:
name: docker-otelcol-arm64
path: ./docker-otelcol/arm64
- uses: actions/upload-artifact@v4
with:
name: docker-otelcol-ppc64le
path: ./docker-otelcol/ppc64le
integration-vet:
name: integration-vet
runs-on: ubuntu-24.04
strategy:
matrix:
ARCH: [ "amd64", "arm64" ]
fail-fast: false
needs: [ "docker-otelcol", "otelcol" ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- uses: actions/download-artifact@v4
with:
name: otelcol-${{ matrix.ARCH }}
path: ./bin
- uses: actions/download-artifact@v4
with:
name: docker-otelcol-${{ matrix.ARCH }}
path: ./docker-otelcol/${{ matrix.ARCH }}
- uses: docker/setup-qemu-action@v3
if: ${{ matrix.ARCH != 'amd64' }}
with:
platforms: ${{ matrix.ARCH }}
image: tonistiigi/binfmt:qemu-v7.0.0
- run: docker load -i ./docker-otelcol/${{ matrix.ARCH }}/image.tar
- run: ln -sf otelcol_linux_${{ matrix.ARCH }} ./bin/otelcol
- run: chmod a+x ./bin/*
- run: make integration-vet
env:
SPLUNK_OTEL_COLLECTOR_IMAGE: 'otelcol:latest'
integration-test-docker:
runs-on: ubuntu-24.04
needs: [ "docker-otelcol", "otelcol" ]
strategy:
matrix:
ARCH: [ "amd64", "arm64" ]
PROFILE: [ "integration", "smartagent" ]
fail-fast: false
env:
TEST_OUTPUT: ${{ github.job }}-${{ matrix.PROFILE }}-${{ matrix.ARCH }}.out
steps:
# Multiarch images require more disk space
- uses: jlumbroso/free-disk-space@v1.3.1
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build ${{ matrix.PROFILE }} service images
run: |
images=$(yq '.services[] | select(.profiles[] | . == "${{ matrix.PROFILE }}") | .image' docker/docker-compose.yml | grep "quay.io/splunko11ytest/" | sort -u)
for image in $images; do
service=$(basename "$image" | cut -d ':' -f1)
if [[ -f docker/${service}/Dockerfile ]]; then
docker build --cache-from=quay.io/splunko11ytest/${service}:latest -t quay.io/splunko11ytest/${service}:latest docker/${service}
fi
done
docker system prune -f
docker builder prune -f
docker images
- run: docker compose -f docker/docker-compose.yml --profile ${{ matrix.PROFILE }} up -d --quiet-pull
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- uses: actions/download-artifact@v4
with:
name: otelcol-${{ matrix.ARCH }}
path: ./bin
- uses: actions/download-artifact@v4
with:
name: docker-otelcol-${{ matrix.ARCH }}
path: ./docker-otelcol/${{ matrix.ARCH }}
- uses: docker/setup-qemu-action@v3
if: ${{ matrix.ARCH != 'amd64' }}
with:
platforms: ${{ matrix.ARCH }}
image: tonistiigi/binfmt:qemu-v7.0.0
- run: docker load -i ./docker-otelcol/${{ matrix.ARCH }}/image.tar
- run: ln -sf otelcol_linux_${{ matrix.ARCH }} ./bin/otelcol
- run: chmod a+x ./bin/*
- uses: shogo82148/actions-setup-redis@v1.35.1
if: matrix.PROFILE == 'integration'
with:
auto-start: false
redis-port: "6379"
- run: redis-cli ping
if: matrix.PROFILE == 'integration'
- run: redis-cli set tempkey tempvalue
if: matrix.PROFILE == 'integration'
- name: Run Integration Test
run: |
set -o pipefail
target="integration-test"
if [[ "${{ matrix.PROFILE }}" = "smartagent" ]]; then
target="smartagent-integration-test"
fi
make $target 2>&1 | tee $TEST_OUTPUT
exit_status=${PIPESTATUS[0]}
echo "Exit status: $exit_status"
exit $exit_status
env:
SPLUNK_OTEL_COLLECTOR_IMAGE: 'otelcol:latest'
# The Integration Test output is extremely large so we upload it as an artifact
- name: Upload Integration Test Output as Artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.TEST_OUTPUT }}
path: ${{ env.TEST_OUTPUT }}
retention-days: 5
integration-test-binary:
runs-on: ${{ matrix.RUNNER }}
needs: [ "agent-bundle-linux", "otelcol" ]
strategy:
matrix:
RUNNER: [ "ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04" ]
PROFILE: [ "integration", "smartagent" ]
fail-fast: false
env:
TEST_OUTPUT: ${{ github.job }}-${{ matrix.PROFILE }}-${{ matrix.RUNNER }}.out
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build ${{ matrix.PROFILE }} service images
run: |
images=$(yq '.services[] | select(.profiles[] | . == "${{ matrix.PROFILE }}") | .image' docker/docker-compose.yml | grep "quay.io/splunko11ytest/" | sort -u)
for image in $images; do
service=$(basename "$image" | cut -d ':' -f1)
if [[ -f docker/${service}/Dockerfile ]]; then
docker build --cache-from=quay.io/splunko11ytest/${service}:latest -t quay.io/splunko11ytest/${service}:latest docker/${service}
fi
done
docker system prune -f
docker builder prune -f
docker images
- run: docker compose -f docker/docker-compose.yml --profile ${{ matrix.PROFILE }} up -d --quiet-pull
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- uses: actions/download-artifact@v4
with:
pattern: agent-bundle-linux-amd64
merge-multiple: true
path: ./dist
- run: sudo mkdir -p /usr/lib/splunk-otel-collector
- run: sudo tar -xzf dist/agent-bundle_linux_amd64.tar.gz -C /usr/lib/splunk-otel-collector
- run: sudo chown -R $USER /usr/lib/splunk-otel-collector
- run: /usr/lib/splunk-otel-collector/agent-bundle/bin/patch-interpreter /usr/lib/splunk-otel-collector/agent-bundle
- uses: actions/download-artifact@v4
with:
name: otelcol-amd64
path: ./bin
- run: ln -sf otelcol_linux_amd64 ./bin/otelcol
- run: chmod a+x ./bin/*
- uses: shogo82148/actions-setup-redis@v1.35.1
if: matrix.PROFILE == 'integration'
with:
auto-start: false
redis-port: "6379"
- run: redis-cli ping
if: matrix.PROFILE == 'integration'
- run: redis-cli set tempkey tempvalue
if: matrix.PROFILE == 'integration'
- name: Run Integration Test
run: |
set -o pipefail
target="integration-test"
if [[ "${{ matrix.PROFILE }}" = "smartagent" ]]; then
target="smartagent-integration-test"
fi
make $target 2>&1 | tee $TEST_OUTPUT
exit_status=${PIPESTATUS[0]}
echo "Exit status: $exit_status"
exit $exit_status
env:
SPLUNK_OTEL_COLLECTOR_IMAGE: ""
# The Integration Test output is extremely large so we upload it as an artifact
- name: Upload Integration Test Output as Artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.TEST_OUTPUT }}
path: ${{ env.TEST_OUTPUT }}
retention-days: 5
integration-test-discovery-matrix:
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.get-matrix.outputs.matrix }}
steps:
- name: Get matrix
id: get-matrix
run: |
includes=""
for service in "apache" "jmx/cassandra" "kafkametrics" "mongodb" "nginx"; do
for arch in "amd64" "arm64"; do
if [ "$service" = "mongodb" ]; then
# tests for mongo "6.0" and "7.0" are flaky, skipping for now
for mongodb_version in "4.0" "4.4" "5.0"; do
includes="${includes},{\"SERVICE\": \"${service}\", \"ARCH\": \"${arch}\", \"MONGODB_VERSION\": \"${mongodb_version}\"}"
done
elif [[ "$service" != "jmx/cassandra" || "arm64" != "$arch" ]]; then
includes="${includes},{\"SERVICE\": \"${service}\", \"ARCH\": \"${arch}\"}"
fi
done
done
matrix="{\"include\": [${includes#,}]}"
echo "$matrix" | jq
echo "matrix=${matrix}" >> $GITHUB_OUTPUT
integration-test-discovery:
name: integration-test-discovery
runs-on: ubuntu-24.04
needs: [ "docker-otelcol", "otelcol", "integration-test-discovery-matrix" ]
strategy:
matrix: ${{ fromJSON(needs.integration-test-discovery-matrix.outputs.matrix) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: echo "MONGODB_VERSION=${{ matrix.MONGODB_VERSION }}" > docker/.env
if: matrix.SERVICE == 'mongodb'
- run: docker compose -f docker/docker-compose.yml --profile integration-test-${{ matrix.SERVICE }}-discovery up -d --wait --build --quiet-pull
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- uses: actions/download-artifact@v4
with:
name: otelcol-${{ matrix.ARCH }}
path: ./bin
- uses: actions/download-artifact@v4
with:
name: docker-otelcol-${{ matrix.ARCH }}
path: ./docker-otelcol/${{ matrix.ARCH }}
- uses: docker/setup-qemu-action@v3
if: ${{ matrix.ARCH != 'amd64' }}
with:
platforms: ${{ matrix.ARCH }}
image: tonistiigi/binfmt:qemu-v7.0.0
- run: docker load -i ./docker-otelcol/${{ matrix.ARCH }}/image.tar
- run: ln -sf otelcol_linux_${{ matrix.ARCH }} ./bin/otelcol
- run: chmod a+x ./bin/*
- name: Run ${{ matrix.SERVICE }} Discovery Integration Test
run: make integration-test-${{ matrix.SERVICE }}-discovery
env:
SPLUNK_OTEL_COLLECTOR_IMAGE: 'otelcol:latest'