Skip to content

Append journal output to build failure errors - #4703

Draft
kingsleyzissou wants to merge 3 commits into
osbuild:mainfrom
kingsleyzissou:journal-logs
Draft

Append journal output to build failure errors#4703
kingsleyzissou wants to merge 3 commits into
osbuild:mainfrom
kingsleyzissou:journal-logs

Conversation

@kingsleyzissou

Copy link
Copy Markdown
Collaborator

Summary

When a Cockpit image build fails and no buildlog or upload result is available, the error shown to users is generic and unhelpful. This PR reads the systemd journal for the build's transient unit and surfaces that output in the error details, giving users actual diagnostic information.

Changes

  • Add readJournalLogs helper that reads the last 50 journal lines for a compose's systemd unit via cockpit.spawn, returning undefined on failure so journal errors never mask the original build error
  • Wire journal output into the two getComposeStatus failure branches where no buildlog exists (error ids 10 and 28)
  • Add a simulate-failed-build.sh script for manual testing in a Cockpit VM

@kingsleyzissou

Copy link
Copy Markdown
Collaborator Author

I added a convenience script for simulating a build failure. You can run it with:

./scripts/simulate-failed-build.sh <blueprint-uuid>

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.75%. Comparing base (1df3490) to head (ae8ccda).

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4703      +/-   ##
==========================================
- Coverage   77.85%   77.75%   -0.10%     
==========================================
  Files         263      263              
  Lines        7036     7036              
  Branches     2551     2587      +36     
==========================================
- Hits         5478     5471       -7     
- Misses       1462     1472      +10     
+ Partials       96       93       -3     
Flag Coverage Δ
playwright 59.69% <ø> (-0.09%) ⬇️
vitest 73.10% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 4 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1df3490...ae8ccda. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kingsleyzissou

Copy link
Copy Markdown
Collaborator Author

@lucasgarfield fyi

kingsleyzissou and others added 3 commits August 5, 2026 10:25
Uses cockpit.spawn() to call journalctl directly rather than the
cockpit/journal module, whose Deferred-based API doesn't reliably
settle when the underlying spawn rejects.

Co-authored-by: Claude Sonnet 4 <noreply@anthropic.com>
When a build fails and no buildlog or upload result is available, the
error is generic. Reading the systemd journal for the transient unit
surfaces richer diagnostic info in those cases.

Co-authored-by: Claude Sonnet 4 <noreply@anthropic.com>
Simulates a failed image build for manual testing of journal log
output in the Cockpit UI. Uses a fixed UUID so repeated runs don't
create multiple fake composes. Includes a --cleanup flag to remove
the simulated compose directory and blueprint entry.

Co-authored-by: Claude Sonnet 4 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant