build: T3664: improve support for custom build hooks #767
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change Summary
Make build hooks embedded in flavors and improve their flexibility.
Types of changes
Component(s) name
Image build scripts.
Proposed changes
I'm taking advantage of the fact that we don't have any official flavors that use that mechanism yet, and I haven't seen anyone using it in the community either. The changes are breaking but I believe necessary to make the custom hook mechanism powerful enough for its intended purpose.
The option is now
build_hook
rather thanpost_build_hook
— the motivation is that it's a part of the build processes. The hook builds artifacts that built-in functionality cannot build, the fact that it operates on a raw images produced by a built-in function is an implementation detail.Image version and architecture are passed to the hook as arguments.
There's a way to pass custom arguments to the hook script as well, via
--build-hook-opts
/build_hook_opts
option.The hook script is now embedded in the flavor file. This solves the problem of how to distribute hook scripts and where to store them and how to put them in
$PATH
. People in the community can just share single-file flavors, and our CI workflows can also just take single TOML files.For example, this is how one could re-create building a qcow2 image with a hook:
How to test
Checklist: