capi: add final image hygiene goss checks - #2065
Conversation
3883d21 to
f8c8697
Compare
|
/test pull-azure-sigs |
f8c8697 to
b7340cc
Compare
2e7f6ab to
ffc1716
Compare
mboersma
left a comment
There was a problem hiding this comment.
Thanks for this! The intent is great and it's correctly guarded to Linux-only, follows our existing goss conventions, and runs after sysprep so the cleaned-up state is actually present. It won't break builds.
One substantive thing though: the SSH-host-key and core-dump checks don't actually assert anything as written. find ... -print exits 0 whether or not it finds matches, and stdout: [] in goss means "no required stdout patterns", not "output must be empty". So both checks pass unconditionally and would never catch a leftover key or core file. You can see the same stdout: [] pattern on crictl ps in goss-command.yaml, which always prints a header yet passes.
To make them effective, I'd have the command exit non-zero when something is found, something like:
sh -c '! find /etc/ssh -xdev -type f -name "ssh_host_*_key" | grep -q .'
The machine-id, cloud-init instance-id, and /var/log size checks all use exit-status meaningfully, so those are fine.
A couple of smaller things: the core-dump find / scans the whole filesystem with a 10s timeout, which could get slow or flaky on larger images, and once that check is effective the *.core/core.* patterns could match legitimate files. The 200MB /var/log threshold is also a bit arbitrary. None of those are blockers.
4bf7554 to
99ce77f
Compare
Signed-off-by: Maximilian Rink <maximilian.rink@telekom.de>
99ce77f to
7cb6763
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mboersma The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…ene-goss capi: add final image hygiene goss checks
What this does
/var/logcontent are absent from captured images.OS != windows.Why
Validation
git diff --checkdocker run --rm --platform linux/arm64/v8 -v "$PWD":/work -w /work/images/capi python:3.12-bookworm bash -lc ./scripts/ci-goss-populate.sh