Repository navigation
evetest: hand the linuxkit cache back to the user after a test - #7127
milan-zededa wants to merge 1 commit into
Conversation
make evetest mounts ~/.linuxkit/cache into the evetest container, which runs as root (to create the SDN tunnel, TAP devices, bridges and dummy interfaces, and to use /dev/kvm and the Docker socket). When TestVGAPassthroughNoHostAccess compiles its bpftrace tracer there, bpftrace-compiler creates cache/blobs/sha256 and rewrites index.json as root. The user's linuxkit can then neither add blobs to the cache nor update its index, and on CI the next job's "rm -fr ~/.linuxkit" fails with "Permission denied", so the runner fails every suite it picks up within seconds. Chown the mounted linuxkit and bpftrace-compiler caches to the host user whenever the entrypoint fixes the ownership of the artifacts. A container killed before it gets to that still leaves root-owned files behind, so CI also removes the cache with sudo, as it already does for the workspace and the collected artifacts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Milan Lenco <milan@zededa.com>
|
@christoph-zededa Please review, it addresses permission errors that we got over the weekend on the nightly runs after the #7089 change, for example: https://github.com/lf-edge/eve/actions/runs/43766754157/job/132984959897 |
|
@claude confirm the origin of the linuxkit's cache at /root and evaluate if execution under proper user isn't possible to fix the issue. |
|
Claude finished @rene's task in 1m 32s —— View job Answer1. Origin of the cache at
# evetest/Makefile:168-172
BPFTRACE_COMPILER_MOUNTS := \
-v .../eve-tools/bpftrace-compiler:/eve-tools/bpftrace-compiler:ro \
-v $(HOME)/.linuxkit/cache:/root/.linuxkit/cache \
-v $(EVETEST_HOME_DIR)/bpftrace-compiler-cache:/root/.bpftrace-compiler/cacheThe mount target is 2. Could "proper use" (running non‑root) fix it instead of chown‑ing back? Not realistically, and the PR's approach is the right one. The evetest container is required to run as root for its core job, independent of bpftrace — see
Options for running as the host user, and why they don't apply here:
So the container must create these files as root, and the only clean way to hand them back is to · branch |
Description
Since #7089,
make evetestmounts the host's~/.linuxkit/cacheinto theevetest container, which runs as root (to create the SDN tunnel, TAP devices,
bridges and dummy interfaces, and to use
/dev/kvmand the Docker socket).When
TestVGAPassthroughNoHostAccesscompiles its bpftrace tracer there(only on a miss in the bpftrace-compiler cache, e.g. for a new EVE kernel),
bpftrace-compiler creates
cache/blobs/sha256and rewritesindex.jsonasroot. The user's own linuxkit can then neither add blobs to the cache nor
update its index.
On CI this took a runner out of service: the next job's
rm -fr ~/.linuxkitin "Clean stale state from previous runs" failed withPermission denied, sofarfalle-runner-evetest-04failed 42 suites withinseconds each across the last three evetest-nightly runs and one evetest-pr
run.
This PR:
user in
evetest/entrypoint.sh, at the same points where the artifactsalready get their ownership fixed (after
go testexits and in the signalhandler), through a new
set_host_ownershipwrapper;~/.linuxkitwithsudoin the evetest-nightly and evetest-prcleanup steps, as a backstop for a container killed before it could chown
the cache (as is already done for the workspace and the artifacts).
How to test and validate this PR
Start from an empty linuxkit cache and bpftrace-compiler cache, so that
the tracer has to be compiled:
Run the test against a broker whose EVE VM has a vIOMMU and a VGA
controller (otherwise the test skips before compiling):
The log must show
could not find compiled script in cache, compiling now ....After the test exits, nothing in the caches must be owned by root:
Without this PR,
~/.linuxkit/cache/blobs,blobs/sha256andindex.jsonare owned by root andrm -fr ~/.linuxkitfails withPermission denied.Verified locally both ways (reproduced without the fix, clean with it).
Changelog notes
None (test framework and CI only).
PR Backports
Not to be backported as a separate PR. Instead, this commit should be added
to the open backports of #7089, which introduced the issue:
Checklist
And the last but not least:
check them.
🤖 Generated with Claude Code