Skip to content
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

cmd: add helper for seed generation #674

Merged
merged 2 commits into from
May 14, 2024
Merged

Conversation

mvo5
Copy link
Contributor

@mvo5 mvo5 commented May 8, 2024

To ensure that manifests get random(ish) and stable UUIDs we set the rng seed arg based on the filename.

This should fix the issue discovered in
osbuild/manifest-db#124

that duplicated UUIDs for xfs/btrfs can trigger random(ish) and hard to diagnose errors.

This is the same as
osbuild/osbuild-composer#4124 hopefully for the right place this time.

To ensure that manifests get random(ish) and stable UUIDs we set the rng seed arg based on the filename.

This should fix the issue discovered in
osbuild/manifest-db#124

that duplicated UUIDs for xfs/btrfs can trigger random(ish) and hard to diagnose errors.

This is the same as
osbuild/osbuild-composer#4124 hopefully for the right place this time.
Copy link
Member

@achilleas-k achilleas-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but the linter is unhappy (fakeNamer is unused).

Simplify the previous commit so that SeedArgFor() takes strings
for the image type and distribution instead of the `namer`
interface. This makes the code a little bit easier to follow but
now the `distro.Distro` and `distro.ImageType` cannot be directly
passed into the helper anymore so it's a tradeoff.

Ideally it would just take `distro.{Distro,ImageType}` but for
that we would need an easy way to construct fake objects of
these types in our tests which there (currently) is not (AFAICT).

So settle with this approach as a compromise for now.
@mvo5
Copy link
Contributor Author

mvo5 commented May 14, 2024

LGTM but the linter is unhappy (fakeNamer is unused).

Thank you! Silly me, fixed now :)

Copy link
Contributor

@bcl bcl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@bcl bcl requested a review from achilleas-k May 14, 2024 16:55
@bcl bcl dismissed achilleas-k’s stale review May 14, 2024 16:56

linter is happy :)

@bcl bcl added this pull request to the merge queue May 14, 2024
Merged via the queue into osbuild:main with commit 7701f39 May 14, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants