-
Notifications
You must be signed in to change notification settings - Fork 362
168 lines (154 loc) · 6.14 KB
/
vmtests.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
name: vmtests
on:
pull_request:
paths-ignore:
- 'docs/**'
push:
branches:
- main
paths-ignore:
- 'docs/**'
jobs:
build:
name: Build tetragon
runs-on: ubuntu-latest
timeout-minutes: 30
concurrency:
group: ${{ github.ref }}-vmtest-build
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: go/src/github.com/cilium/tetragon/
- name: Install Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
# renovate: datasource=golang-version depName=go
go-version: '1.23.2'
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y libelf-dev netcat-traditional libcap-dev gcc libc6-dev-i386
echo `which clang`
echo `which llc`
echo `clang --version`
- name: Build
env:
GOPATH: /home/runner/work/tetragon/tetragon/go
run: |
cd go/src/github.com/cilium/tetragon/
make -j3 tetragon-bpf tester-progs test-compile
make -C tests/vmtests
- name: Split tests
run: |
# see testfile below
cd go/src/github.com/cilium/tetragon/
go run ./tools/split-tetragon-gotests -ci-run 1
- name: tar build
run: |
cd go/src/github.com/cilium/
tar cz --exclude='tetragon/.git' -f /tmp/tetragon.tar ./tetragon
- name: upload build
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: tetragon-build
path: /tmp/tetragon.tar
retention-days: 5
test:
strategy:
fail-fast: false
matrix:
kernel:
# renovate: datasource=docker depName=quay.io/lvh-images/kernel-images
- 'rhel8.9-20240806.173325'
# renovate: datasource=docker depName=quay.io/lvh-images/kernel-images
- 'bpf-next-20240624.013140'
# renovate: datasource=docker depName=quay.io/lvh-images/kernel-images
- '6.6-20240620.102250'
# renovate: datasource=docker depName=quay.io/lvh-images/kernel-images
- '6.1-20240620.102250'
# renovate: datasource=docker depName=quay.io/lvh-images/kernel-images
- '5.15-20240620.102250'
# renovate: datasource=docker depName=quay.io/lvh-images/kernel-images
- '5.10-20240620.102250'
# renovate: datasource=docker depName=quay.io/lvh-images/kernel-images
- '5.4-20240620.102250'
# renovate: datasource=docker depName=quay.io/lvh-images/kernel-images
- '4.19-20240620.102250'
group:
- 0
concurrency:
group: ${{ github.ref }}-vmtest-${{ matrix.kernel }}-${{ matrix.group }}
cancel-in-progress: true
needs: build
name: Test kernel ${{ matrix.kernel }} / test group ${{ matrix.group }}
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Install VM test dependencies
run: |
sudo apt-get update
sudo apt-cache search qemu
sudo apt-get install -y mmdebstrap libguestfs-tools qemu-utils qemu-system-x86 cpu-checker qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst virt-manager isc-dhcp-client
- name: Make kernel accessible
run: |
sudo chmod go+rX -R /boot/
- name: download build data
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: tetragon-build
- name: extract build data
# NB: currently, due to how tests work, we need to extract to the same path.
run: |
mkdir -p go/src/github.com/cilium/
tar xf tetragon.tar -C go/src/github.com/cilium
- name: test kernel ${{ matrix.kernel }}
if: ${{ !startsWith(matrix.kernel, '4.19') }}
run: |
cd go/src/github.com/cilium/tetragon
./tests/vmtests/fetch-data.sh ${{ matrix.kernel }}
kimage=$(find tests/vmtests/test-data/kernels -path "*vmlinuz*" -type f)
echo "Using: kernel:$kimage"
sudo ./tests/vmtests/tetragon-vmtests-run \
--kernel ${kimage} \
--kernel-ver ${{ matrix.kernel }} \
--base tests/vmtests/test-data/images/base.qcow2 \
--enable-detailed-results \
--testsfile ./tests/vmtests/test-group-${{ matrix.group }}
- name: test kernel ${{ matrix.kernel }} with btf file
if: ${{ startsWith(matrix.kernel, '4.19') }}
run: |
cd go/src/github.com/cilium/tetragon
./tests/vmtests/fetch-data.sh ${{ matrix.kernel }}
kimage=$(find tests/vmtests/test-data/kernels -path "*vmlinuz*" -type f)
btf=$(find tests/vmtests/test-data/kernels -path "*btf*" -type f)
echo "Using: kernel:$kimage bptf:$btf"
sudo ./tests/vmtests/tetragon-vmtests-run \
--kernel ${kimage} \
--kernel-ver ${{ matrix.kernel }} \
--btf-file ${btf} \
--base tests/vmtests/test-data/images/base.qcow2 \
--enable-detailed-results \
--testsfile ./tests/vmtests/test-group-${{ matrix.group }}
- name: Chmod test results on failure or cancelation
if: failure() || cancelled()
run: |
sudo chmod -R go+rX go/src/github.com/cilium/tetragon/tests/vmtests/vmtests-results-*
- name: Upload test results on failure or cancelation
if: failure() || cancelled()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: tetragon-vmtests-${{ matrix.kernel }}-${{ matrix.group }}-results
path: go/src/github.com/cilium/tetragon/tests/vmtests/vmtests-results-*
retention-days: 5
post-test:
runs-on: ubuntu-latest
needs: [test]
if: success()
steps:
# delete the built binaries from the artifacts in case of overall success
- uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: tetragon-build