Skip to content

reporegistry: support loading repos from fs.FS#1037

Closed
mvo5 wants to merge 4 commits intoosbuild:mainfrom
mvo5:distro-embeding
Closed

reporegistry: support loading repos from fs.FS#1037
mvo5 wants to merge 4 commits intoosbuild:mainfrom
mvo5:distro-embeding

Conversation

@mvo5
Copy link
Copy Markdown
Contributor

@mvo5 mvo5 commented Nov 12, 2024

[based on https://github.com//pull/1036 and draft because it need 1036 and a tweak in osbuild-composer to make the repos there embeddable - mostly here so that people can see where this is heading]

reporegistry: support loading repos from fs.FS

This is a first step towards loading repositories via go:embed
and fully compatible with the old way of loading repos.

mvo5 added 4 commits November 12, 2024 11:46
This commit removes some directory traversal duplication from
LoadRepositories() on the expense of more "expensive" repo loading.
The new code will just always load all repos and return the one
matching the distro. The advantage of this approach is that when
aliases are introduced there is only a single code path that needs
changing.
This commit introduces a new `distro.aliases` file that replaces the
role of the existing symlinks to provide an alias name for a distro.
The reason is that when using `go:embed` symlinks are not supported
and we have currently `centos-9.json -> centos-stream-9.json` in
our `osbuild-comopser` distro definitions.

By moving them from symlinks to alias files we can start using
`go:embed` which is nice for the daemonless work, i.e. the
`image-builder` binary will be self-contained and one can do:
```
$ go run github.com/osbuild/image-builder/cmd/image-builder --list-images
```
directly without any further configuration. It also solves how to
keep the default repository configuration between `osbuild-composer` and
`image-builder-cli` in sync.
This is a first step towards loading repositories via `go:embed`
and fully compatible with the old way of loading repos.
@mvo5 mvo5 requested a review from thozza November 12, 2024 12:15
mvo5 added a commit to mvo5/images that referenced this pull request Nov 12, 2024
This commit is a (hopefully) less controversial version of:
osbuild#1037

Here only a new helper to load repository information from an
`fs.FS` is added and only used for loading the test repositories.

This will help to have a single test repository that can be
embedded accross osbuild-composer, image-builder and images.

It also removes the public "NewTestedDefault()" in favor of a
new `testrepos.New()` helper so that the `reporegistry` only
has non-test API left.
@mvo5
Copy link
Copy Markdown
Contributor Author

mvo5 commented Nov 12, 2024

Closing in favor of #1038

@mvo5 mvo5 closed this Nov 12, 2024
github-merge-queue Bot pushed a commit that referenced this pull request Nov 16, 2024
This commit is a (hopefully) less controversial version of:
#1037

Here only a new helper to load repository information from an
`fs.FS` is added and only used for loading the test repositories.

This will help to have a single test repository that can be
embedded accross osbuild-composer, image-builder and images.

It also removes the public "NewTestedDefault()" in favor of a
new `testrepos.New()` helper so that the `reporegistry` only
has non-test API left.
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