-
Notifications
You must be signed in to change notification settings - Fork 4
423 lines (403 loc) · 19.2 KB
/
test.yaml
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
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
name: Test
on:
workflow_call:
env:
IMAGE_DEBIAN_OLDEST: 'debian:oldstable'
IMAGE_DEBIAN_STABLE: 'debian:stable'
IMAGE_DEBIAN_LATEST: 'debian:testing'
IMAGE_DEBIAN_DEV: 'debian:unstable'
IMAGE_DEBIAN_SLIM_OLDEST: 'debian:oldstable-slim'
IMAGE_DEBIAN_SLIM_STABLE: 'debian:stable-slim'
IMAGE_DEBIAN_SLIM_LATEST: 'debian:testing-slim'
IMAGE_DEBIAN_SLIM_DEV: 'debian:unstable-slim'
IMAGE_UBUNTU_OLDEST: 'ubuntu:focal' # needs manual maintenance on April 2025 (https://ubuntu.com/about/release-cycle)
IMAGE_UBUNTU_STABLE: 'ubuntu:latest'
IMAGE_UBUNTU_LATEST: 'ubuntu:rolling'
IMAGE_UBUNTU_DEV: 'ubuntu:devel'
IMAGE_CENTOS_OLDEST: '' # CentOS is EOL
IMAGE_CENTOS_STABLE: '' # CentOS is EOL
IMAGE_CENTOS_LATEST: 'centos:latest'
IMAGE_CENTOS_DEV: 'centos:latest'
IMAGE_FEDORA_OLDEST: 'fedora:40' # needs manual maintenance on June 2025 (https://docs.fedoraproject.org/en-US/releases/lifecycle/)
IMAGE_FEDORA_STABLE: 'fedora:41' # needs manual maintenance on June 2025 (https://docs.fedoraproject.org/en-US/releases/lifecycle/)
IMAGE_FEDORA_LATEST: 'fedora:latest'
IMAGE_FEDORA_DEV: 'fedora:rawhide'
IMAGE_RHEL_OLDEST: 'redhat/ubi8:latest' # needs manual maintenance
IMAGE_RHEL_STABLE: 'redhat/ubi9:latest' # needs manual maintenance
IMAGE_RHEL_LATEST: 'redhat/ubi9:latest' # needs manual maintenance
IMAGE_RHEL_DEV: '' # not public
IMAGE_OPENSUSE_OLDEST: 'opensuse/leap:15.5' # needs manual maintenance on January 2025 (https://endoflife.date/opensuse)
IMAGE_OPENSUSE_STABLE: 'opensuse/leap:latest'
IMAGE_OPENSUSE_LATEST: 'opensuse/tumbleweed:latest'
IMAGE_OPENSUSE_DEV: '' # not public
jobs:
build:
uses: ./.github/workflows/build.yaml
smoke:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: packages
- run: sudo -E apt-get -y install ./package.deb
- run: bash -c "cd tests && bash run_tests.sh bash"
- run: sudo apt-get -y remove opentelemetry-shell
prepare-upgrade:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.dynamic-matrix.outputs.matrix }}
steps:
- run: |
curl --no-progress-meter --fail --retry 16 --retry-all-errors --header "Authorization: Bearer $GITHUB_TOKEN" --head https://api.github.com/repos/"$GITHUB_REPOSITORY"/releases?per_page=100 \
| tr '[:upper:]' '[:lower:]' | grep '^link: ' | cut -d ' ' -f 2- | tr -d ' <>' | tr ',' '\n' | grep 'rel="last"' | cut -d ';' -f 1 | cut -d '?' -f 2- | tr '&' '\n' | grep '^page=' | cut -d = -f 2 \
| xargs seq 1 | xargs -I '{}' curl --no-progress-meter --fail --retry 16 --retry-all-errors --header "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/"$GITHUB_REPOSITORY"/releases?per_page=100\&page={} | jq -r '.[].tag_name' \
| grep -v - | grep -v '^v1.0.0$' | grep -v '^v1.1.0$' | grep -v '^v1.12.6$' \
| jq -nR '{"include": [inputs | select(length > 0) | {tag_name: .}]}' | tr -d '\n' | xargs -0 -I {} echo 'matrix={}' >> "$GITHUB_OUTPUT"
id: dynamic-matrix
env:
GITHUB_TOKEN: ${{ github.token }}
upgrade:
needs: [prepare-upgrade, smoke]
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix: ${{ fromJSON(needs.prepare-upgrade.outputs.matrix) }}
steps:
- run: |
curl --no-progress-meter --fail --retry 16 --retry-all-errors --header "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/"$GITHUB_REPOSITORY"/releases/tags/${{ matrix.tag_name }} | jq -r '.assets[].browser_download_url' | xargs wget --header "Authorization: Bearer $GITHUB_TOKEN"
env:
GITHUB_TOKEN: ${{ github.token }}
- run: sudo apt-get -y install ./*.deb
- uses: actions/download-artifact@v4
with:
name: packages
- run: sudo apt-get -y install ./package.deb
prepare-images:
runs-on: ubuntu-latest
outputs:
images: ${{ steps.dynamic.outputs.images }}
images_upgradeable: ${{ steps.dynamic.outputs.images_upgradeable }}
steps:
- uses: actions/checkout@v4
- run: |
min_version="$(cat src/DEBIAN/control | grep '^Pre-Depends:' | tr ',' '\n' | grep -F -- 'python3 (>=' | cut -d '(' -f 2- | cut -d ')' -f 1 | cut -d ' ' -f 2 | cut -d . -f 2)"
printenv | grep '^IMAGE_' | while read -r kvp; do
key="$(echo "$kvp" | cut -sd '=' -f 1 | tr '[:upper:]' '[:lower:]')"
value="$(echo "$kvp" | cut -sd '=' -f 2)"
if [ -z "$value" ]; then continue; fi
echo '((apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install python3) || dnf -y install python3 || yum -y install python3 || zypper --non-interactive install python3) > /dev/null && python3 --version' \
| sudo docker run --rm --network=host -i "$value" \
| cut -d ' ' -f 2 | cut -d . -f 2 | while read -r version; do [ "$version" -ge "$min_version" ] && echo "{\"image\":\"$value\",\"os\":\"$(echo "$key" | cut -d _ -f 2)\",\"type\":\"$(echo "$key" | cut -d _ -f 3)\"}" || true; done
done | jq -s > images.json
[ "$(cat images.json | jq -r '.[].image' | wc -l)" -ge 5 ] # double check that we dont fail everywhere and then run no tests at all
cat images.json | jq '.[] | select(.type != "dev")' | jq .image | sort -u | jq -s -r tostring | xargs -0 -I {} echo 'images={}' >> "$GITHUB_OUTPUT"
cat images.json | jq '.[] | select(.type != "dev") | select(.type != "latest") | select(.os == "ubuntu")' | jq .image | sort -u | jq -s -r tostring | xargs -0 -I {} echo 'images_upgradeable={}' >> "$GITHUB_OUTPUT"
id: dynamic
prepare-shells:
runs-on: ubuntu-latest
outputs:
shells: ${{ steps.dynamic.outputs.shells }}
steps:
- uses: actions/checkout@v4
- run: |
{
echo sh
cat src/DEBIAN/control | grep '^Enhances: ' | tr ' ' '\n' | tr ',' '\n' | grep -v -F 'Enhances:' | grep -v '^$'
} | sort -u | while read -r shell; do echo "\"$shell\""; done | jq -s -r tostring | xargs -0 -I {} echo 'shells={}' >> "$GITHUB_OUTPUT"
id: dynamic
system-upgrade:
needs: [ prepare-images, smoke ]
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
image: ${{ fromJSON(needs.prepare-images.outputs.images_upgradeable) }}
steps:
- uses: actions/download-artifact@v4
with:
name: packages
- run: |
echo '
apt-get update
apt-get -y install /root/package.deb
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade && apt-get -y autoremove && apt-get -y autoclean
case "$(cat /etc/os-release | grep '^NAME=' | cut -d = -f 2 | tr -d "\"")" in
Ubuntu)
DEBIAN_FRONTEND=noninteractive apt-get -y install sed systemctl update-manager-core
sed -i "/Prompt/d" /etc/update-manager/release-upgrades && echo "Prompt=normal" >> /etc/update-manager/release-upgrades
do-release-upgrade -c || exit 0 && RELEASE_UPGRADER_ALLOW_THIRD_PARTY=1 do-release-upgrade -f DistUpgradeViewNonInteractive
;;
Debian*)
DEBIAN_FRONTEND=noninteractive apt-get -y install curl sed
version_destination="$(curl -sL https://deb.debian.org/debian/dists/testing/InRelease | grep "^Codename:" | cut -d " " -f 2)"
version_source="$(cat /etc/os-release | grep '^VERSION_CODENAME' | cut -d = -f 2)"
sed -i "s/$version_source/$version_destination/g" /etc/apt/sources.list /etc/apt/sources.list.d/*
sed -i "s/oldstable/testing/g" /etc/apt/sources.list /etc/apt/sources.list.d/*
sed -i "s/stable/testing/g" /etc/apt/sources.list /etc/apt/sources.list.d/*
;;
*) exit 1;;
esac
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade && apt-get -y autoremove && apt-get -y autoclean
' | sudo docker run -v $(pwd)/package.deb:/root/package.deb --rm --network=host -i --entrypoint=/bin/sh ${{ matrix.image }} -e
prepare-dependency:
runs-on: ubuntu-latest
outputs:
dependencies: ${{ steps.dynamic.outputs.dependencies }}
steps:
- uses: actions/checkout@v4
- run: cat src/DEBIAN/triggers | cut -sd ' ' -f 2- | rev | cut -sd / -f 1 | rev | grep -v '^$' | grep -v '^python3$' | sort -u | while read -r dependency; do echo "\"$dependency\""; done | jq -s -r tostring | xargs -0 -I {} echo 'dependencies={}' >> "$GITHUB_OUTPUT"
id: dynamic
dependency:
needs: [ prepare-dependency, prepare-images, smoke ]
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
image: ${{ fromJSON(needs.prepare-images.outputs.images) }}
dependency: ${{ fromJSON(needs.prepare-dependency.outputs.dependencies) }}
steps:
- uses: actions/download-artifact@v4
with:
name: packages
- run: |
echo '
if type apt-get; then
apt-get update
apt-get -y remove ${{ matrix.dependency }}
DEBIAN_FRONTEND=noninteractive apt-get -y install /root/package.deb
DEBIAN_FRONTEND=noninteractive apt-get -y install ${{ matrix.dependency }}
apt-get -y remove ${{ matrix.dependency }}
elif type dnf; then
dnf -y upgrade --refresh
dnf -y remove ${{ matrix.dependency }}
dnf -y install /root/package.rpm
dnf -y install ${{ matrix.dependency }}
dnf -y remove ${{ matrix.dependency }}
elif type yum; then
yum -y update
yum -y remove ${{ matrix.dependency }}
yum -y install /root/package.rpm
yum -y install ${{ matrix.dependency }}
yum -y remove ${{ matrix.dependency }}
elif type zypper; then
zypper --non-interactive remove ${{ matrix.dependency }} || true
zypper --non-interactive install --allow-unsigned-rpm /root/package.rpm
zypper --non-interactive install ${{ matrix.dependency }}
zypper --non-interactive remove ${{ matrix.dependency }}
else
exit 1
fi
' | sudo docker run -v $(pwd)/package.deb:/root/package.deb -v $(pwd)/package.rpm:/root/package.rpm --rm --network=host -i --entrypoint=/bin/sh ${{ matrix.image }} -e
install-manual-user:
needs: [ smoke ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cat INSTALL.sh | sh -x
- run: type otel.sh
install-manual-os:
needs: [ prepare-images, smoke ]
runs-on: ubuntu-latest
strategy:
matrix:
image: ${{ fromJSON(needs.prepare-images.outputs.images) }}
steps:
- uses: actions/checkout@v4
- run: |
{
echo '
if type apt-get; then apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install wget curl jq gawk sudo
elif type dnf; then dnf -y install wget jq gawk sudo
elif type yum; then yum -y install wget jq gawk sudo
elif type zypper; then zypper --non-interactive install wget jq gawk sudo
else exit 1
fi
'
cat INSTALL.sh
echo type otel.sh
} | sudo docker run --rm --network=host -i --entrypoint=/bin/sh ${{ matrix.image }} -e
linux-shell:
needs: [ prepare-images, prepare-shells, smoke ]
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
os: ${{ fromJSON(needs.prepare-images.outputs.images) }}
update: ['FALSE', 'TRUE']
shell: ${{ fromJSON(needs.prepare-shells.outputs.shells) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: packages
- run: mv ./package.* tests
- run: bash -c 'cd tests && bash run_tests_containerized.sh "${{ matrix.os }}" "${{ matrix.update }}" "${{ matrix.shell }}"'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
windows-shell:
needs: [ prepare-shells, smoke ]
runs-on: windows-latest
timeout-minutes: 60
strategy:
matrix:
shell: ${{ fromJSON(needs.prepare-shells.outputs.shells) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- uses: Vampire/[email protected]
- shell: wsl-bash {0}
run: |
retry() {
while ! "$@"; do sleep 60; done
}
retry sudo apt-get update
retry sudo -E apt-get -y install ./packages/package.deb dos2unix jq psmisc wget curl time sudo
for package in parallel moreutils ncat wget2 python3 python3-pip gcc docker; do # TODO nodejs npm
sudo -E apt-get -y install "$package" || true
done
[ ${{ matrix.shell }} = sh ] || retry sudo -E apt-get -y install ${{ matrix.shell }} || exit 0
dos2unix tests/*.sh tests/*/*
bash -c "cd tests && bash run_tests.sh ${{ matrix.shell }}"
sudo apt-get -y remove opentelemetry-shell
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
action:
needs: smoke
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- run: printenv | grep '^GITHUB_'
- uses: actions/download-artifact@v4
with:
name: packages
- run: sudo -E apt-get install ./package.deb
- uses: actions/checkout@v4
- uses: ./actions/instrument/job
env:
OTEL_METRICS_EXPORTER: console
OTEL_LOGS_EXPORTER: console
OTEL_TRACES_EXPORTER: console
- run: echo hello world # check if simple command fails
- run: sudo apt-get update
- run: | # check if instrumentation happened
[ "$(alias | grep '_otel_observe' | wc -l)" -gt 0 ]
- run: | # check if traceparent is injected
[ -n "$TRACEPARENT" ]
- uses: actions/download-artifact@v4 # check if node action works
with:
name: packages
- uses: actions/hello-world-docker-action@main # check if docker action works
- uses: actions/first-interaction@v1 # node action with - in env vars
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Hello, thanks for adding an issue for the first time!"
pr-message: "Hello, thanks for contributing for the first time!"
- uses: renovatebot/[email protected] # integration, node action with call to docker, docker flags that make injection more complicated, then call a node script via exec that already is injected with otel
env:
RENOVATE_DRY_RUN: full
RENOVATE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RENOVATE_REPOSITORIES: ${{ github.repository }}
LOG_LEVEL: debug
- uses: docker/setup-qemu-action@v3 # some docker actions have otel built-in
- uses: docker/setup-buildx-action@v3 # some docker actions have otel built-in
- run: cp package.deb tests/package.deb
- uses: docker/build-push-action@v6 # some docker actions have otel built-in
with:
context: ./tests/
tags: test
push: false
build-args: |
image=ubuntu:latest
update=TRUE
shell=bash
prepare-performance:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.dynamic-matrix.outputs.matrix }}
steps:
- run: |
{ echo '~local'; curl --no-progress-meter --fail --retry 16 --retry-all-errors --header "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/"$GITHUB_REPOSITORY"/releases | jq -r .[].tag_name | head --lines=10; } | jq -nR '{"include": [inputs | select(length > 0) | {tag_name: .}]}' | tr -d '\n' | xargs -0 -I {} echo 'matrix={}' >> "$GITHUB_OUTPUT"
id: dynamic-matrix
env:
GITHUB_TOKEN: ${{ github.token }}
performance:
needs: [prepare-performance, smoke]
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix: ${{ fromJSON(needs.prepare-performance.outputs.matrix) }}
steps:
- if: matrix.tag_name == '~local'
uses: actions/download-artifact@v4
with:
name: packages
- if: matrix.tag_name != '~local'
run: |
curl --no-progress-meter --fail --retry 16 --retry-all-errors --header "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/"$GITHUB_REPOSITORY"/releases | jq -r '.[] | select(.tag_name == "${{ matrix.tag_name }}") | .assets[].browser_download_url' | grep '.deb$' | xargs wget --header "Authorization: Bearer $GITHUB_TOKEN"
env:
GITHUB_TOKEN: ${{ github.token }}
- run: sudo apt-get install -y ./*.deb
- run: |
export OTEL_SHELL_SDK_OUTPUT_REDIRECT=/dev/null
command time -f '%U' bash -c '. /usr/bin/opentelemetry_shell.sh' 2>> performance.${{ matrix.tag_name }}.coldstart.list
for i in $(seq 1 100); do command time -f '%U' bash -c '. /usr/bin/opentelemetry_shell.sh' 2>> performance.${{ matrix.tag_name }}.warmstart.list; done
- uses: actions/upload-artifact@v4
with:
name: performance.${{ matrix.tag_name }}.coldstart.list
path: performance.${{ matrix.tag_name }}.coldstart.list
retention-days: 1
- uses: actions/upload-artifact@v4
with:
name: performance.${{ matrix.tag_name }}.warmstart.list
path: performance.${{ matrix.tag_name }}.warmstart.list
retention-days: 1
join:
needs: [upgrade, system-upgrade, dependency, install-manual-user, install-manual-os, linux-shell, windows-shell, action, performance]
runs-on: ubuntu-latest
outputs:
success: ${{ steps.tests.outputs.success }}
steps:
- id: tests
run: echo "success=true" >> "$GITHUB_OUTPUT"
all:
if: ${{ always() }}
needs: [join]
runs-on: ubuntu-latest
steps:
- env:
SUCCESS: ${{ needs.join.outputs.success }}
run: |
[ "$SUCCESS" = 'true' ]
- uses: actions/download-artifact@v4
with:
pattern: 'performance.*.list'
merge-multiple: true
- run: |
for file in performance.*.list; do
type=$(echo $file | rev | cut -d . -f 2 | rev)
version=$(echo $file | cut -d . -f 2- | rev | cut -d . -f 3- | rev)
cat "$file" | grep -v 'No such file or directory' | sort -n | head -n 1 | xargs echo "$version" >> "$type".list
done
- run: |
sudo apt-get update && sudo apt-get install -y gnuplot-nox
echo '
set terminal pngcairo enhanced font "Verdana,10" size 1024,1024
set output "performance.png"
set title "Performance Comparison"
set xlabel "Version"
set xtics rotate by -45
set ylabel "Performance"
set logscale y 10
plot "coldstart.list" using 0:2:xticlabels(1) with linespoints title "Cold Start" lt rgb "blue", "warmstart.list" using 0:2:xticlabels(1) with linespoints title "Warm Start" lt rgb "red"
' > plot.gp
gnuplot plot.gp
- uses: actions/upload-artifact@v4
with:
name: performance.png
path: performance.png
retention-days: 90