-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
manifest: zstd
#1247
manifest: zstd
#1247
Conversation
16bc74f
to
ae3730e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat!
Conflict :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine, some suggestions inline (could be followups but the duplication is something that might be worth doing now).
pkg/distro/fedora/distro.go
Outdated
@@ -454,6 +454,36 @@ var ( | |||
basePartitionTables: minimalrawPartitionTables, | |||
requiredPartitionSizes: requiredDirectorySizes, | |||
} | |||
|
|||
minimalrawZstdImgType = imageType{ | |||
name: "minimal-raw-zst", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(wondering) should this be minimal-raw-zstd
(notice the leading d
) ? I know the extension if zst
(which I personally find very confusing) so maybe fine? idk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I indeed picked it based on the extension so the image type is related to the output artifact, I did things in the same style in #1233.
pkg/distro/fedora/distro.go
Outdated
}, | ||
defaultImageConfig: &distro.ImageConfig{ | ||
EnabledServices: minimalRawServices, | ||
// NOTE: temporary workaround for a bug in initial-setup that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This duplicates a lot of the existing minimal-raw with only minimal changes - including this workaround which means we will (if we ever remove it) keep the two in sync. How about just making a "maker" function to keep them in sync automatically? Something like:
diff --git a/pkg/distro/fedora/distro.go b/pkg/distro/fedora/distro.go
index 5959db425..9921a24e4 100644
--- a/pkg/distro/fedora/distro.go
+++ b/pkg/distro/fedora/distro.go
@@ -424,42 +424,16 @@ var (
exports: []string{"container"},
requiredPartitionSizes: requiredDirectorySizes,
}
+ minimalrawImgType = makeMinimalRaw("minimal-raw", "xz", "xz")
+ minimalrawZstdImgType = makeMinimalRaw("minimal-raw-zst", "zstd", "zst")
+)
- minimalrawImgType = imageType{
- name: "minimal-raw",
- filename: "disk.raw.xz",
- compression: "xz",
- mimeType: "application/xz",
- packageSets: map[string]packageSetFunc{
- osPkgsKey: packageSetLoader,
- },
- defaultImageConfig: &distro.ImageConfig{
- EnabledServices: minimalRawServices,
- // NOTE: temporary workaround for a bug in initial-setup that
- // requires a kickstart file in the root directory.
- Files: []*fsnode.File{initialSetupKickstart()},
- Grub2Config: &osbuild.GRUB2Config{
- // Overwrite the default Grub2 timeout value.
- Timeout: 5,
- },
- },
- rpmOstree: false,
- kernelOptions: defaultKernelOptions,
- bootable: true,
- defaultSize: 2 * datasizes.GibiByte,
- image: diskImage,
- buildPipelines: []string{"build"},
- payloadPipelines: []string{"os", "image", "xz"},
- exports: []string{"xz"},
- basePartitionTables: minimalrawPartitionTables,
- requiredPartitionSizes: requiredDirectorySizes,
- }
-
- minimalrawZstdImgType = imageType{
- name: "minimal-raw-zst",
- filename: "disk.raw.zst",
- compression: "zstd",
- mimeType: "application/zstd",
+func makeMinimalRaw(name, compression, ext string) imageType {
+ return imageType{
+ name: name,
+ filename: "disk.raw." + ext,
+ compression: compression,
+ mimeType: "application/" + compression,
packageSets: map[string]packageSetFunc{
osPkgsKey: packageSetLoader,
},
@@ -479,12 +453,12 @@ var (
defaultSize: 2 * datasizes.GibiByte,
image: diskImage,
buildPipelines: []string{"build"},
- payloadPipelines: []string{"os", "image", "zstd"},
- exports: []string{"zstd"},
+ payloadPipelines: []string{"os", "image", compression},
+ exports: []string{compression},
basePartitionTables: minimalrawPartitionTables,
requiredPartitionSizes: requiredDirectorySizes,
}
-)
+}
type distribution struct {
name string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sort of thing keeps popping up and we do it in various ways (we also just 'copy' image types and then adjust some of their properties in the newDistro
function as well so the above would introduce a '3rd way'.
I don't particularly care which way we pick; do you want me to do your suggestion or the newDistro
way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, yeah, the newDistro()
way seems fine then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a commit to do this.
There's a `zstd` stage in `osbuild` which was never plumbed through. This copies over the `xz` stage and adjusts the name. Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
This copies over the `xz` manifest to add a `zstd` one. Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
Adds a new image type [1] that is equal to the `minimal-raw` image type for Fedora Minimal; however it uses `zstd` compression which is much faster to compress thus speeding up the build. [1]: fedora-minimal/distribution-minimal#12 Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
A small test that ensures some bits are in zstd manifest. Co-authored-by: Michael Vogt <michael.vogt@gmail.com> Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
Instead of duplication let's copy the minimal raw image type and change some of its properties inside `newDistro`. Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
Rebased, resolved conflicts, addressed comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks! :) I still think that the final compression should be just configurable per build (with a sane default per image type), but this is a step in the correct direction.
How would you feel about adding a minimal-raw-zstd
alias for minimal-raw-zst
? I think it may remove some friction...
@@ -726,6 +696,14 @@ func newDistro(version int) distro.Distro { | |||
} | |||
vhdImgType.defaultImageConfig = vhdConfig.InheritFrom(qcow2ImgType.defaultImageConfig) | |||
|
|||
minimalrawZstdImgType := minimalrawImgType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's interesting that the image type name is "minimal-raw-zst", but the variable name is "minimalRawZstdImgType". My gut feeling is that the d shouldn't be there.
Implements the existing
zstd
stage from osbuild and creates the appropriate scaffolding to use it.Also enables a new image type for Fedora Minimal that uses it 1.