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

[RFC] data: copy all repositories from osbuild-composer to images #1112

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mvo5
Copy link
Contributor

@mvo5 mvo5 commented Dec 19, 2024

This PR is an attempt to have my cake and eat it. In a nutshell:

  1. Nothing^Wvery little changes for composer when handling
    the repos. They are still normal files but instead of getting
    them from the repositories/ subdir the files are now
    part of vendor/github.com/osbuild/images/data/repositories
    (i.e. we just modify the specfile to copy from there, otherwise
    all the same logic)
  2. image-builder-cli can ship the defaults directly in the binary
    which means it is possible to just "go run github.com/..image-builder-cli"
  3. If nothing (go) imports the repos no extra data is added to the
    binaries
  4. We still support overrides by first using the search path for
    real files and then falling back to the buildin repos (not done yet) [1]

Except for (slightly) higher complexity I see no real downsides
currently, but maybe I'm in love too much with my idea, have
a (critical!) look please.

[1] Happy to fix reporegistry but I don't want to spend too much time
upfront if the idea is not liked


This commit moves the repositories from osbuild-composer to
images. The rational is that we need a central place to host
the repositories so that they can be shared between osbuild-composer
and image-builder-cli.

The other reason is that conceptually images is (arguably) be a
better place because it knows how to build osbuild manifests and
it can only build those for distro releases it knows about. The
filenames are already part of the API of images (as it derives
the distro name from the filename) and it is impossible to add
new distros (except maybe point releases) without also updateing
images to deal with the details of the new distro.


data: make repositories available via go:embed

This commit allows us to discover/load repositories via go:embed.
Note that unlike the testrepos.go code this one does not provide
a New() helper. Instead we will modify the RepoRegistry to
look for the search paths for repo configuration first and then
fallback to the buildin repos (unless disabled via a flag).

Embedding also allows us an easy transition path in composer. The
rpm specfile will simply need to copy the repository data from
vendor/github.com/osbuild/images/data/repositories instead of
the current location and we can delete the repositories already
covered here (composer will still carry the -no-aux-keys repos
and the symlinks (which sadly cannot be expressed via go:embed)).

mvo5 added 2 commits December 19, 2024 09:35
This commit moves the repositories from `osbuild-composer` to
images. The rational is that we need a central place to host
the repositories so that they can be shared between osbuild-composer
and image-builder-cli.

The other reason is that conceptually images is (arguably) be a
better place because it knows how to build osbuild manifests and
it can only build those for distro releases it knows about. The
filenames are already part of the API of images (as it derives
the distro name from the filename) and it is impossible to add
new distros (except maybe point releases) without also updateing
images to deal with the details of the new distro.
This commit allows us to discover/load repositories via `go:embed`.
Note that unlike the `testrepos.go` code this one does not provide
a `New()` helper. Instead we will modify the `RepoRegistry` to
look for the search paths for repo configuration first and then
fallback to the buildin repos (unless disabled via a flag).

Embedding also allows us an easy transition path in composer. The
rpm specfile will simply need to copy the repository data from
`vendor/github.com/osbuild/images/data/repositories` instead of
the current location and we can delete the repositories already
covered here (composer will still carry the `-no-aux-keys` repos
and the symlinks (which sadly cannot be expressed via go:embed)).
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.

1 participant