starting 1.1 development #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
with: | |
path: go/src/github.com/cilium/tetragon/ | |
- name: Install Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | |
with: | |
go-version-file: 'go/src/github.com/cilium/tetragon/go.mod' | |
- name: Install build dependencies | |
run: | | |
sudo apt install libelf-dev netcat-traditional libcap-dev gcc | |
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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
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 | |
- 'bpf-next-20231030.012704' | |
# renovate: datasource=docker depName=quay.io/lvh-images/kernel-images | |
- '6.1-20231026.065108' | |
# renovate: datasource=docker depName=quay.io/lvh-images/kernel-images | |
- '5.15-20231026.065108' | |
# renovate: datasource=docker depName=quay.io/lvh-images/kernel-images | |
- '5.10-20231026.065108' | |
# renovate: datasource=docker depName=quay.io/lvh-images/kernel-images | |
- '5.4-20231026.065108' | |
# renovate: datasource=docker depName=quay.io/lvh-images/kernel-images | |
- '4.19-20231026.065108' | |
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-4cores-16gb | |
timeout-minutes: 60 | |
steps: | |
- name: Install VM test dependencies | |
run: | | |
sudo apt-get -qy update | |
sudo apt-cache search qemu | |
sudo apt-get -qy install mmdebstrap libguestfs-tools qemu-utils qemu-system-x86 cpu-checker qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst virt-manager | |
- name: Make kernel accessible | |
run: | | |
sudo chmod go+rX -R /boot/ | |
- name: download build data | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
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 \ | |
--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 \ | |
--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@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
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: | |
- name: Create truncated build file | |
run: | | |
touch /tmp/tetragon.tar | |
- name: Upload truncated file | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 | |
with: | |
name: tetragon-build | |
path: /tmp/tetragon.tar | |
retention-days: 1 |