libbpf / ci

BPF CI
Other
7 stars 21 forks source link

[prepare-rootfs] improve rootfs selection #84

Closed chantra closed 6 months ago

chantra commented 1 year ago

Currently, we run tests in a Debian Bullseye rootfs. This works with our current CI runners (Ubuntu focal) but this is very brittle.

  1. in the past, we had some dependency issues.
  2. people may run vmtests from different hosts then Ubuntu focal.

The way we do rootfs selection at the moment is pretty simple: https://github.com/libbpf/ci/blob/1b794627fd7431428a7e5a077010285733eaedf2/prepare-rootfs/run.sh#L223C26-L231

The rootfs have the distro release in their name, so we could possibly filter on this. The script to generate rootfs uses debootstrap and should work with pretty much any Debian derivative.

We could generate a rootfs for common rootfs we care about, put them all in INDEX and when selecting the rootfs, try to match the hosts' distro, and fallback on a default one otherwise.

This should help with #83, and avoid issues like we had in the past (see comment in that PR).

Because currently libbpf/ci and vmtest in kernel tree differ, we would also need to update https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/testing/selftests/bpf/vmtest.sh?id=c1a3daf7363b48c6c4b86aee2efa2287f695f649#n106 with the change.

Given the current behaviour of that function, we may be able to get away with updating the index file and the test will just pick up whatever is latest alphabetically.

iii-i commented 1 year ago

I like this proposal, thanks for looking into it. A small suggestion: it would also be nice to provide a way to specify the distro manually when running vmtest.sh.

chantra commented 6 months ago

Since #117 was landed and used in BPF CI, this should not be a problem anymore.