-
Notifications
You must be signed in to change notification settings - Fork 54
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
pkg: make seed
in ImageType.Manifest()
random by default
#1107
Conversation
This commit changes the API of `ImageType.Manifest()` to take a pointer to the seed value. If no seed value is given it will automatically generate a random one. This avoid the pitfall that the consumer needs to know about properly seeding the manifests. The default use-case is to generate non-fixed seed manifests so this commit it easier.
This PR changes the images API or behaviour causing integration failures with osbuild-composer. The next update of the images dependency in osbuild-composer will need work to adapt to these changes. This is simply a notice. It will not block this PR from being merged. |
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 like that it's safe by default.
// A custom seed for the rng can be specified, if nil the seed will | ||
// be random. |
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.
Maybe we can be more accurate and informative here and say that it will be derived from the current time.
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.
Thanks! I'm happy to do that, I was thinking of using crypto.Rand to seed the generator but maybe I'm overthinking it. Happy to either document or change.
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.
Not important. Can do later or not at all.
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.
Thanks, this looks OK to me.
seed
in ImageType.Manifest()
random by defaultseed
in ImageType.Manifest()
random by default
I prepared the followups to fix the consumers |
This commit changes the API of
ImageType.Manifest()
to take a pointer to the seed value. If no seed value is given it will automatically generate a random one.This avoid the pitfall that the consumer needs to know about properly seeding the manifests. The default use-case is to generate non-fixed seed manifests so this commit makes it easier.
[edit: this is one possible way to avoid https://github.com/osbuild/image-builder-cli/pull/6#discussion_r1882807289]