Repository navigation
Extras: User-selectable multiple explicit exports: sysexts and partitions (HMS-11288, HMS-11287) - #2700
Conversation
Replace `ExcludeDocs`, `GPGKeyFiles`, `InstallLangs`, `ImageID`, `ImageVersion` and `RPMKeysBinary` fields that are all in `OSCustomizations` with a single `BaseRPMOptions`. This makes it easier in the future to store the same `BaseRPMOptions` onto other customizations so multiple pipelines can use the same customizations. Signed-off-by: Simon de Vlieger <[email protected]>
`NewXZ`, `NewZstd`, `NewGzip` and `GetCompressionPipeline` get a `name` argument. If it's empty then the previous default name is used. This is necessary so we can export multiple artifacts in the future. Currently we can't have two pipelines with the same name so pipelines that can appear multiple times need to have unique names (or be set to unique names). Signed-off-by: Simon de Vlieger <[email protected]>
Allow defining `extras` for image types. Extras are things that are built 'on top of' (or together with) an image type and thus they are intimately coupled together. As an example you can take `systemd` sysexts which are the diff between an OS pipeline and another pipeline. Files inside the image that need to be exported separately. Partitions that we want to export separately as well. This commit only makes *room* for those extras to be defined in the future. This is so that it can land independent of what extras we decide to implement. Signed-off-by: Simon de Vlieger <[email protected]>
Create new pipeline generators (`SysextTree` and `SystextPrep`) that are to be used to build `systemd` systemd extensions in the future. `SysextTree` installs packages into a tree using the same RPM options (passed through Customizations) and (optionally) the same packages from a reference pipeline. `SysextPrep` (prepare) diffs the `SysextTree` against a filesystem reference pipeline which would usually be the `OS` pipeline or a pipeline that contains a `bootc` deployment. The `SyextPrep` tree then contains only file differences between these two pipelines. Signed-off-by: Simon de Vlieger <[email protected]>
Add `sysext` as an extras type. These extras are made up of a name (key) and a package set that will be plumbed into the image functions to generate additional pipelines when defined. Signed-off-by: Simon de Vlieger <[email protected]>
Generate pipelines in the image generators if sysexts are defined in the definitions. That includes copying around some fields and bits and bobs and injecting the appropriate pipelines including one dependent on the format of the sysext. Signed-off-by: Simon de Vlieger <[email protected]>
8085940 to
5bf532e
Compare
Create a new `PartitionImage` pipeline which takes in a previous pipeline which generated a (raw) image and then extracts a given partition from it. The partition is (currenltly) selectable by its mount point only. Signed-off-by: Simon de Vlieger <[email protected]>
Add `partitions` as a new extras type alongside sysexts. Each partition defines a mountpoint to extract into a separate extra with an optional filename and compression. This allows to split out partitions (for example `/usr`) together with the full image build. Signed-off-by: Simon de Vlieger <[email protected]>
Plumb the partitions definitions from the loader through imagetype into the `DiskImage` pipeline generator. Each split parttition extracts its partition from the raw image with an optional compression pipeline. Signed-off-by: Simon de Vlieger <[email protected]>
We need an easy way to go from 'human' names to pipeline names and an easy way to list available extras for an image type. `ExportPipelineNames()` is the former. It uses the same plumbing as is used for generating the pipeline names in the image functions so they always match. `Extras` just returns a pre-formatted list of `type:name` pairs for extras. Signed-off-by: Simon de Vlieger <[email protected]>
Add tests that assert output name behavior before we start touching the
code for it. This ensures we don't accidentally break something.
`TestDefaultOutputTmplBackwardCompat` tests that the default output
template produces `{distro}-{imagetype}-{arch}`.
`TestBuildIntegrationSingleOutput` ensures that a build (without
additional flags) produces one image and has the expected file.
`TestOutputFilenameStable` makes sure that the output filename and its
extension match what's defined in `.Filename()` (because we'll drop its
usage in a follow-up commit).
Signed-off-by: Simon de Vlieger <[email protected]>
Support passing extras one the command line which are exported together with the main export; which is the export as defined in the image type. This is an explicit way for the user to opt-in to exporting additional artifacts. In the future other extras can be added to allow for named pipelines to be exported, or other bits and bobs. This follows pretty lengthy chats and discussions around allowing the export of any pipeline. For now we opt for the explicit route, only extras defined can be exported so we have the additional metadata to do this right. Signed-off-by: Simon de Vlieger <[email protected]>
Fail early when a requested extra does not exist, before manifest generation and the build so we're a bit quicker and don't have users passing nonexistent extras. Signed-off-by: Simon de Vlieger <[email protected]>
Show available extras by name in the describe subcommand output. This lets users discover which extras are available for `--with-extras`. Signed-off-by: Simon de Vlieger <[email protected]>
|
Though I didn't want this PR to be too much about the concrete extras themselves (more the concept of extras) we're bound to have some ideas/questions for them. How should the partition splitting work for volume-based mountpoints ( Right now in this PR it fails if people define a |
If a mount point is inside a container type then we walk up to the plain partition and export the entire thing instead of erroring out during manifest generation. Perhaps this behavior is debatable but when documented I think it's right; and there's not really anything else we can do *except* not supporting this. Signed-off-by: Simon de Vlieger <[email protected]>
I've pushed my commit that does this (it's the last one). |
achilleas-k
left a comment
There was a problem hiding this comment.
Nice work on all of this. I'm very happy with how the new pipelines look. Still not entirely happy with the way we define these, but we're not locked into that so we can see how it feels going forward and iterate.
Thank you.
LGTM!
Regarding the last commit (exporting volumes from inside containers): I agree that the behaviour in the PR is probably the best workaround for btrfs subvolumes, but I think for LVM logical volumes, it's possible to dd the logical volume separately instead of the whole partition (volume group), isn't it?
| SilenceUsage: true, | ||
| Args: cobra.ExactArgs(1), | ||
| } | ||
| buildCmd.Flags().StringArray("with-extra", nil, `include an extra by type:name in the build (e.g. --with-extra sysext:nginx)`) |
There was a problem hiding this comment.
I think instead of an example it would be more useful to mention where one can find the supported extras. Pointing users towards using describe to get a list of supported extra names would be better.
There was a problem hiding this comment.
Agreed, but let's not back it out over this 🙂
This PR introduces the concept of 'extras' to
image-builderand its definitions.extrasare specifically-typed additional artifacts with metadata that are part of a single image definition.Some examples of extras:
/usr,/, etc).sysextswhich are built against the main artifactsospipeline.ospipeline.This PR has gone through a lot of cycles and time mostly due to the fact that we wanted to be generic (and kinda implicit) by allowing arbitrary pipeline exports. In the end we always needed explicitness (multiple pipeline exports still need to be listed in YAML) and more explicitness allows for more metadata, hence the addition of an
extras.Extras pipelines are always in the manifest and not conditionally inserted; I consider them to be part of the build and thus they should be able to be built everywhere the manifest goes.
This PR comes with two concrete implementations of extras.
sysext(#2662) andpartition(#2632) but really they're just in a supporting role here for the idiom of extras.I'm still not especially fond of some things but I think it's largely in a good enough state to land and iterate on without it blocking any potential use cases or breaking current ones.
Note: extras can practically export multiple pipelines, current ones do not. If we were to do that and those exports would have the same extension then we need to be careful as we can't currently disambiguate in the
output-nametemplate. We can introduce that once we cross that bridge. It's fine as long as we have, for example, a single extra export two pipelines: one that createspartition.rawand one that creates apartition.raw.sigor such.A quick example of how this would look like. Firstly available extras are listed in the output of the
describecommand. The format is an 'extra reference' which is$type:$name.When building the image type normally we get what we expect, however when we build we can enable additional extras to be produced. (In the future we will probably include either globbing for extras an 'all extras' flag).
This doesn't yet implement extras for bootable container based systems. However this will be a follow-up. We'll do that by allowing bootable containers to supply an
extras.yamlfile in the well-known locations we use for other sources of configuration: https://osbuild.org/docs/developer-guide/projects/image-builder/advanced/bootc/sources-of-configuration/#filesystem