many: compression all the time - #2545
Conversation
f4ecf17 to
6dde57c
Compare
|
Sill seems like a good idea to me, previous discussion is on #2395 |
There were no tests for `GetCompressionPipeline` yet. Let's introduce one where we compress a tar archive. I want to fiddle with the compression pipelines in the next commits so it's a good idea to first test the current behavior. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
When we make compression user-selectable in the future I'd like to allow for selecting `none` compression instead of using empty-value string. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Turn compression from strings that are case-matched into an enum that serves as the keys in a map. This allows for adding additional data to be added to a certain compression type and gives us a bit more guarantees that things are absolutely set correctly. An example of additional data would be to include the default extension for a given compression. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
dd8b9c3 to
9109e76
Compare
|
I had fun and wired this through entirely to the To show this works I've introduced a Examples: |
Always include all compression pipelines in manifests instead of only the selected compression pipeline. This allows to select the wanted compression at the calling side (`image-builder`, `osbuild-composer`, etc). Currently our image types always encode a single compression type which means we need multiple image types. This allows us to get rid of that and override the compression with (for example) a command line argument or blueprint option. Still some things to address. For example the default filenames of compression pipelines aren't all that nice and not based on anything. We likely want to have those be overridable too. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Replace the bare `Compression` string field on `ImageTypeYAML` with a `CompressionConfig` struct containing a `Default` member. This prepares for adding an `Allowed` list so users can select compression at build time. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Add an `Allowed` field to `CompressionConfig` so that image type definitions can declare which compressions are valid for a given artifact. Some artifacts cannot be compressed differently because either it doesn't make sense (due to their name) or because they need a specific compression to be what they claim to be. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Allow callers to select a compression at build time via ImageOptions. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
In checkOptionsCommon, reject compression selections that are not in the image type's allowed list. When the allowed list is empty, any compression is accepted (backwards compatible). Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Prefer the caller's compression selection from ImageOptions over the YAML default via CompressionConfig.Select(). This allows build requesters to choose a compression at build time. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Allow both xz and zstd compression for the minimal-raw-xz and minimal-raw-zst image types, enabling callers to select compression at build time. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Wire through the compression selection from the CLI to ImageOptions so users can override the default compression for manifest and build commands. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
The Exports() and Filename() methods on the ImageType now accept a compression override so that the exported pipeline and output filename can match the selected compression rather than the static default. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
An empty allowed list meant any compression was accepted. Now it means the image type does not support compression overrides at all, and passing --compression will produce an error. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
When an image type has compression.default set to "none" and a compression override is selected, append the compression extension to the base filename (e.g. "disk.raw" becomes "disk.raw.xz"). This lets image types that default to no compression but allow compression to be selected at build time which will pretty much be the only case where this is used. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Have a new `minimal-raw` image type that allows for selectable compression. Also keep the `-xz` and -zst` image types for backwards compatibility. These do *not* allow selectable compression. Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
9109e76 to
8b68ed9
Compare
|
I submitted #2578 before seeing this (adding 'raw-xz' image type to 'bootc-generic'). Would this PR allow setting --compression with --bootc-ref builds? |
Theoretically but this PR is a proof of concept so you can undraft yours as it's much less invasive and well make sure any backwards compatibility aliases are kept if necessary if this PR goes in. |
Always includes all compression pipelines in the manifest. Introduces
nonecompression. This will in the future allow for selecting compression at build time instead of it being part of the image type.The future is now; see the later commits in this PR.