Repository navigation
Fix: scope the systemd-analyze assertion to the unit under test (unblocks CI) - #608
Conversation
`deploy-scripts` is red on every PR since the ubuntu-latest runner moved to
Ubuntu 26 (the migration GitHub annotates on each run as starting 2026-10-19):
FAIL: systemd-analyze verify microvm-worker.service reports nothing about
the unit itself (want '', got '/usr/lib/systemd/system/walinuxagent.service:21:
Support for option CPUAccounting= has been removed and it is ignored')
walinuxagent, xfs_scrub_all and system-xfs_scrub are the runner image's OWN
units. `systemd-analyze verify` reports on units it pulls in transitively, and
systemd 258 dropped CPUAccounting=, so a stock runner now emits three warnings
that have nothing to do with us. The assertion excused exactly one known
host-fact diagnostic and demanded the rest be empty, so it read the runner's
units as our defect.
Filter on lines naming the unit being verified, which is what the check already
claims to measure ("reports nothing about the unit itself"), via one helper used
at both call sites. This keeps the check meaningful instead of loosening it --
and the comment above it already records that an unconditional version went red
on every PR and got deleted once; a host-upgrade-sensitive one invites that again.
Verified on real systemd 259 (ubuntu:26.04), not just by reading: seeding a
foreign CPUAccounting= unit and an After= on it reproduces the CI failure
verbatim against the pre-fix code and passes with this change, while seeded
defects in our own unit (unknown key, unparsable value, failed load) are still
caught, alone and buried in the noise.
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: cwiklik <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Summary
This scopes the systemd-analyze verify diagnostics assertion to lines naming the unit under test, through one unit_diagnostics helper used at both call sites. That fixes the deploy-scripts failure caused by the Ubuntu 26 / systemd 258 runner image units (walinuxagent CPUAccounting=). The change matches the check's stated intent ("about the unit itself"), keeps the existing ExecStart host-fact exemption, and leaves the slice exit-status assertion unchanged. One non-blocking nit is inline.
Author: cwiklik (MEMBER — maintainer)
Areas reviewed: Shell (test), CI
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (all 14 checks green, including deploy-scripts)
| # unfiltered assertion reads those as our problem and goes red on every PR -- the exact | ||
| # failure mode the comment above says got this check deleted once already. | ||
| unit_diagnostics() { # <verify output> <unit path> | ||
| printf '%s\n' "$1" | grep -F "$(basename "$2")" | |
There was a problem hiding this comment.
nit: The basename filter also drops verify output that names no unit at all, e.g. manager-level failures such as Failed to initialize manager or Failed to setup .... On CI the service exit status is not asserted (the ExecStart binary isn't installed), so that class of failure would now pass silently, where before it failed. This is narrow and not blocking. If you want to close it, you could also fail on lines that name no .service/.slice/.target unit, or assert sa_rc is 0 or 1 here. Either would keep the host-unit noise out without making the check unable to fail.
Summary
deploy-scriptsfails on every PR since theubuntu-latestrunner moved to Ubuntu 26 — the migration GitHub annotates on each run as beginning 2026-10-19. It is not a product defect; the test reads the runner image's own units as ours.walinuxagent,xfs_scrub_allandsystem-xfs_scrubare Azure runner-image units.systemd-analyze verifyreports on units it pulls in transitively, and systemd 258 removedCPUAccounting=, so a stock runner now emits three warnings about itself. The assertion excused exactly one known host-fact diagnostic (is not executable: No such file or directory) and required everything else to be empty — so the host's own warnings landed as our failure.The fix
Filter to lines naming the unit being verified — which is what the check already claims to measure ("reports nothing about the unit itself") — through one helper used at both call sites (
microvm-worker.service,moca-egress.service).This narrows the filter to the stated intent rather than loosening it. The comment above the check already records that an unconditional version was red on every PR and got deleted once; leaving it sensitive to host upgrades invites that a second time.
Verification
Run on real systemd 259 (
ubuntu:26.04), not inferred — macOS has nosystemd-analyze, so this check self-skips locally and the local suite could not have caught it:CPUAccounting=unit +After=on it, pre-fix codeExecStarthost factshellcheck -S warning: clean.Why separate
Found while addressing review on #607, which it blocks. Split out because it is CI infrastructure for
deploy/microvm, unrelated to that PR'sdeploy/vmRedis change, and it unblocks #605 and everything after it too.Assisted-By: Claude