Skip to content

Isolate build history per output directory, redux - #4376

Merged
behrmann merged 3 commits into
systemd:mainfrom
martinpitt:history-output
Jul 3, 2026
Merged

Isolate build history per output directory, redux#4376
behrmann merged 3 commits into
systemd:mainfrom
martinpitt:history-output

Conversation

@martinpitt

@martinpitt martinpitt commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

The original fixes for parallel tests were in #4360, but one of the key commits broke system and was reverted in #4373. I examined the regression in #4373 (comment) , captured the regression (and systemd-desired behaviour) in a unit test, and reworked the fix to not break existing behaviour (again including a unit test).

I already pushed these commits to #4357 to test them with barrage and actual parellelism, and they work well enough (i.e. sans the opensuse mirror and apk download woes).

I also tested this on systemd: this commit on my fork switches mkosi over to this branch, and the tests work in the sense of "all image builds pass". There are some individual test failures, but they also happen in e.g. systemd/systemd#42755

Details are in the individual commit messages.

@martinpitt

Copy link
Copy Markdown
Contributor Author

@behrmann @daandemeyer friendly review ping? Thanks!

@behrmann behrmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Sorry, had absolutely forgotten about having to look at this.

Comment thread tests/test_config.py Outdated
Comment thread tests/test_config.py Outdated
Comment thread mkosi/config.py Outdated
@martinpitt
martinpitt requested a review from behrmann July 3, 2026 05:30
@behrmann

behrmann commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

In the light of #4381 can you drop the Co-Authored-By: tag on the commit? An Assisted-By: LLM (yes, entirely generic), is fine.

…tput dir

A build can be told its output directory on the command line (`-O`) while a
later verb that consumes the build (vm, boot, summary, …) only knows it from
`OutputDirectory=` in the configuration. As long as both point at the same
directory, the consumer must still find the build history the build wrote.

This is what systemd does: its meson build passes `--output-dir`
explicitly, while a developer running `mkosi vm` (without
`--output-dir`) afterwards relies on `OutputDirectory=`. Capture this
behaviour so we don't regress it again.

This broke once in commit da49fe9 ("Put build history into the output
directory"), which keyed the history location on the CLI value only, and
was reverted in commit 582eade.
When building into separate output directories (e.g. the integration
test suite running in parallel), all builds shared a single build
history in the config directory. A verb that consumes a previous build
(vm, boot, summary, …) then read back whichever build ran last instead
of the one for the output directory it was pointed at.

To fix that and keep an output directory isolated, store the history in
it as well, and prefer it when given `--output-directory`.

The config directory copy is kept and is still used when no `-O` is
passed, so a consumer that gets the output directory from
`OutputDirectory=` in the configuration keeps working (and the
output-dir lookup falls back to it, status quo ante). This is what
commit da49fe9 tried to do, but it stored the history *only* in the
output directory keyed on the CLI value, which broke consumers that take
the output directory from the configuration.

Keying the read on the CLI value and keeping the config-dir copy avoids
that regression. Cover this in the new
`test_history_found_via_configured_output_directory()`.
The integration tests build into a per-test `--output-directory`, but
the verbs that consume the build (vm, boot) did not pass it, so they
recovered the build's configuration from the history in the config
directory. This breaks parallel tests, as they read the history file
from current global file (i.e. whichever build happened to finish last).

This is the tests/__init__.py half of the reverted commit da49fe9.
(That wasn't problematic.)
@behrmann
behrmann merged commit e065090 into systemd:main Jul 3, 2026
57 of 58 checks passed
@martinpitt
martinpitt deleted the history-output branch July 3, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants