repos: lookup <buildin>, /{etc,usr/share}/image-builder/repositories
This commit switches the default repositories to use the build-in ones from images PR#1112. It is still possible to override using `/etc/image-builder` and `/usr/share/image-builder` or `--datadir`. This is implicitly tested via the container test that no longer includes the files from osbuild-composer in the container.
This commit is contained in:
parent
6d9e91eb3c
commit
80cadaf291
4 changed files with 28 additions and 37 deletions
|
|
@ -18,32 +18,6 @@ RUN dnf install -y dnf-plugins-core \
|
||||||
|
|
||||||
COPY --from=builder /build/image-builder /usr/bin/
|
COPY --from=builder /build/image-builder /usr/bin/
|
||||||
|
|
||||||
# install repo data from osbuild-composer in an ugly way
|
|
||||||
# XXX: find a better way
|
|
||||||
RUN <<EOR
|
|
||||||
mkdir -p /usr/share/osbuild-composer/repositories
|
|
||||||
cd /usr/share/osbuild-composer/repositories
|
|
||||||
# XXX: find a better way to organize the upstream supported repos
|
|
||||||
# we cannot just checkout the osbuild-composer repo here as it contains a bunch
|
|
||||||
# of "*-no-aux-key.json" files too, so a naive "cp *.json" will not work.
|
|
||||||
# Ideally we split the supported repos out of osbuild-composer into
|
|
||||||
# either "images" (as it generates the code for supported distro it could
|
|
||||||
# be the place that also defines what is supported) or into its own repo.
|
|
||||||
# Bonus points if we could make them go:embedable :)
|
|
||||||
for fname in centos-stream-9 centos-stream-10 \
|
|
||||||
fedora-40 fedora-41 \
|
|
||||||
rhel-8 rhel-8.1 rhel-8.2 rhel-8.3 rhel-8.4 rhel-8.5 rhel-8.6 \
|
|
||||||
rhel-8.7 rhel-8.8 rhel-8.9 \
|
|
||||||
rhel-9.0 rhel-9.1 rhel-9.2 rhel-9.3 rhel-9.4 rhel-9.5 rhel-9.6 \
|
|
||||||
rhel-10.0; do
|
|
||||||
# XXX: if only we had 'go:embed'able repos :(
|
|
||||||
wget https://raw.githubusercontent.com/osbuild/osbuild-composer/refs/heads/main/repositories/${fname}.json
|
|
||||||
done
|
|
||||||
# XXX: find an even better way here, those are symlinks in the upstream repo
|
|
||||||
cp -a centos-stream-9.json centos-9.json
|
|
||||||
cp -a centos-stream-10.json centos-10.json
|
|
||||||
EOR
|
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
VOLUME /output
|
VOLUME /output
|
||||||
|
|
|
||||||
11
README.md
11
README.md
|
|
@ -31,10 +31,8 @@ we plan to provide rpm packages as well.
|
||||||
|
|
||||||
Make sure to have the required `osbuild` RPMs installed:
|
Make sure to have the required `osbuild` RPMs installed:
|
||||||
```console
|
```console
|
||||||
$ sudo dnf install osbuild osbuild-depsolve-dnf osbuild-composer
|
$ sudo dnf install osbuild osbuild-depsolve-dnf
|
||||||
```
|
```
|
||||||
(`osbuild-composer` is only needed to get the repository definitions
|
|
||||||
and this dependency will go away soon).
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
|
@ -120,6 +118,13 @@ Q: Does this require a backend.
|
||||||
A: The osbuild binary is used to actually build the images but beyond that
|
A: The osbuild binary is used to actually build the images but beyond that
|
||||||
no setup is required, i.e. no daemons like osbuild-composer.
|
no setup is required, i.e. no daemons like osbuild-composer.
|
||||||
|
|
||||||
|
Q: Can I have custom repository files?
|
||||||
|
A: Sure! The repostories are encoded in json in "<distro>-<vesion>.json",
|
||||||
|
files, e.g. "fedora-41.json". See these [examples](https://github.com/osbuild/images/tree/main/data/repositories). Use the "--datadir" switch and
|
||||||
|
place them under "repositories/name-version.json", e.g. for:
|
||||||
|
"--datadir ~/my-project --distro foo-1" a json file must be put under
|
||||||
|
"~/my-project/repositories/foo-1.json.
|
||||||
|
|
||||||
## Project
|
## Project
|
||||||
|
|
||||||
* **Website**: <https://www.osbuild.org>
|
* **Website**: <https://www.osbuild.org>
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,22 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/fs"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/osbuild/images/data/repositories"
|
||||||
"github.com/osbuild/images/pkg/reporegistry"
|
"github.com/osbuild/images/pkg/reporegistry"
|
||||||
)
|
)
|
||||||
|
|
||||||
// XXX: copied from "composer", should be exported there so
|
|
||||||
// that we keep this in sync
|
|
||||||
// XXX2: means we need to depend on osbuild-composer-common or a new rpm
|
|
||||||
// that provides the relevant packages *or* we use go:embed (cf images#1038)
|
|
||||||
//
|
|
||||||
// defaultDataDirs contains the default search paths to look for repository
|
// defaultDataDirs contains the default search paths to look for repository
|
||||||
// data. Note that the repositories are under a repositories/ sub-directory
|
// data. Note that the repositories are under a repositories/ sub-directory
|
||||||
// and contain a bunch of json files of the form "$distro_$version".json
|
// and contain a bunch of json files of the form "$distro_$version".json
|
||||||
// (but that is an implementation detail that the "images" library takes
|
// (but that is an implementation detail that the "images" library takes
|
||||||
// care of).
|
// care of).
|
||||||
var defaultDataDirs = []string{
|
var defaultDataDirs = []string{
|
||||||
"/etc/osbuild-composer",
|
"/etc/image-builder",
|
||||||
"/usr/share/osbuild-composer",
|
"/usr/share/image-builder",
|
||||||
}
|
}
|
||||||
|
|
||||||
var newRepoRegistry = func(dataDir string) (*reporegistry.RepoRegistry, error) {
|
var newRepoRegistry = func(dataDir string) (*reporegistry.RepoRegistry, error) {
|
||||||
|
|
@ -27,5 +27,17 @@ var newRepoRegistry = func(dataDir string) (*reporegistry.RepoRegistry, error) {
|
||||||
dataDirs = defaultDataDirs
|
dataDirs = defaultDataDirs
|
||||||
}
|
}
|
||||||
|
|
||||||
return reporegistry.New(dataDirs)
|
// XXX: think about sharing this with reporegistry?
|
||||||
|
var fses []fs.FS
|
||||||
|
for _, d := range dataDirs {
|
||||||
|
fses = append(fses, os.DirFS(filepath.Join(d, "repositories")))
|
||||||
|
}
|
||||||
|
fses = append(fses, repos.FS)
|
||||||
|
|
||||||
|
// XXX: should we support disabling the build-ins somehow?
|
||||||
|
conf, err := reporegistry.LoadAllRepositoriesFromFS(fses)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return reporegistry.NewFromDistrosRepoConfigs(conf), nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue