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

many: take repositories from the "images" library #4554

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/osbuild-composer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/coreos/go-systemd/journal"
"github.com/getsentry/sentry-go"
sentrylogrus "github.com/getsentry/sentry-go/logrus"
_ "github.com/osbuild/images/data/repositories"
"github.com/osbuild/osbuild-composer/internal/common"
slogger "github.com/osbuild/osbuild-composer/pkg/splunk_logger"
"github.com/sirupsen/logrus"
Expand Down
10 changes: 6 additions & 4 deletions internal/cloudapi/v2/compose_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package v2

import (
"io/fs"
"testing"

"github.com/osbuild/images/data/repositories"
"github.com/osbuild/images/pkg/customizations/subscription"
"github.com/osbuild/images/pkg/disk"
"github.com/osbuild/images/pkg/distrofactory"
Expand Down Expand Up @@ -811,9 +813,9 @@ func TestGetImageRequests_NoRepositories(t *testing.T) {
Repositories: []Repository{},
},
}
// NOTE: current directory is the location of this file, back up so it can use ./repositories/
rr, err := reporegistry.New([]string{"../../../"})
reposConf, err := reporegistry.LoadAllRepositoriesFromFS([]fs.FS{repos.FS})
require.NoError(t, err)
rr := reporegistry.NewFromDistrosRepoConfigs(reposConf)
got, err := request.GetImageRequests(distrofactory.NewDefault(), rr)
assert.NoError(t, err)
require.Len(t, got, 1)
Expand All @@ -837,9 +839,9 @@ func TestGetImageRequests_BlueprintDistro(t *testing.T) {
Distro: common.ToPtr("fedora-39"),
},
}
// NOTE: current directory is the location of this file, back up so it can use ./repositories/
rr, err := reporegistry.New([]string{"../../../"})
reposConf, err := reporegistry.LoadAllRepositoriesFromFS([]fs.FS{repos.FS})
require.NoError(t, err)
rr := reporegistry.NewFromDistrosRepoConfigs(reposConf)
got, err := request.GetImageRequests(distrofactory.NewDefault(), rr)
assert.NoError(t, err)
require.Len(t, got, 1)
Expand Down
15 changes: 8 additions & 7 deletions osbuild-composer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,21 @@ install -m 0755 -vd %{buildroot}%

# Latest CentOS supports building all CentOS versions
%if 0%{?centos} >= 10
install -m 0644 -vp repositories/centos-* %{buildroot}%{_datadir}/osbuild-composer/repositories/
install -m 0644 -vp vendor/github.com/osbuild/images/data/repositories/centos-* %{buildroot}%{_datadir}/osbuild-composer/repositories/

%else
# All other CentOS versions support building for the same version
install -m 0644 -vp repositories/centos-%{centos}* %{buildroot}%{_datadir}/osbuild-composer/repositories/
install -m 0644 -vp repositories/centos-stream-%{centos}* %{buildroot}%{_datadir}/osbuild-composer/repositories/
install -m 0644 -vp vendor/github.com/osbuild/images/data/repositories/centos-%{centos}* %{buildroot}%{_datadir}/osbuild-composer/repositories/
# centos-stream-* are symlinks
cp -a repositories/centos-stream-%{centos}* %{buildroot}%{_datadir}/osbuild-composer/repositories/
%endif

%else

%if 0%{?rhel}
# RHEL 10 supports building all RHEL versions
%if 0%{?rhel} >= 10
for REPO_FILE in $(ls repositories/rhel-* | grep -v 'no-aux-key'); do
for REPO_FILE in $(ls vendor/github.com/osbuild/images/data/repositories/rhel-* | grep -v 'no-aux-key'); do
Copy link
Member

Choose a reason for hiding this comment

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

Calling grep is no longer needed since there are no -no-aux-key repos in `images, right?

install -m 0644 -vp ${REPO_FILE} %{buildroot}%{_datadir}/osbuild-composer/repositories/$(basename ${REPO_FILE})
done

Expand All @@ -183,13 +184,13 @@ done

%else
# All other RHEL versions support building for the same version
for REPO_FILE in $(ls repositories/rhel-%{rhel}* | grep -v 'no-aux-key'); do
for REPO_FILE in $(ls vendor/github.com/osbuild/images/data/repositories/rhel-%{rhel}* | grep -v 'no-aux-key'); do
Copy link
Member

Choose a reason for hiding this comment

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

Calling grep is no longer needed since there are no -no-aux-key repos in `images, right?

install -m 0644 -vp ${REPO_FILE} %{buildroot}%{_datadir}/osbuild-composer/repositories/$(basename ${REPO_FILE})
done

# RHEL 9 supports building also for RHEL 8
%if 0%{?rhel} == 9
for REPO_FILE in $(ls repositories/rhel-8* | grep -v 'no-aux-key'); do
for REPO_FILE in $(ls vendor/github.com/osbuild/images/data/repositories/rhel-8* | grep -v 'no-aux-key'); do
Copy link
Member

Choose a reason for hiding this comment

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

Calling grep is no longer needed since there are no -no-aux-key repos in `images, right?

install -m 0644 -vp ${REPO_FILE} %{buildroot}%{_datadir}/osbuild-composer/repositories/$(basename ${REPO_FILE})
done
%endif
Expand All @@ -200,7 +201,7 @@ done

# Fedora can build for all included fedora releases
%if 0%{?fedora}
install -m 0644 -vp repositories/fedora-* %{buildroot}%{_datadir}/osbuild-composer/repositories/
install -m 0644 -vp vendor/github.com/osbuild/images/data/repositories/fedora-* %{buildroot}%{_datadir}/osbuild-composer/repositories/
%endif

install -m 0755 -vd %{buildroot}%{_unitdir}
Expand Down
12 changes: 12 additions & 0 deletions repositories/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
All repository data is imported via the "images" library, see
https://github.com/osbuild/images/tree/main/data/repositories

Most are imported via the "vendor" mechanism, but some special
repositories are kept here, like the `*-no-aux-key.json` that is for
rhel8 only and will only get installed on rhel10 (because the crypto
policy on rhel10 does not allow the sha1 aux-key in the original
rhel8 keys.

It also contains the centos-* -> centos-stream-* symlinks as
`go:embed` does not support symlinks so we need to keep them
externally.
1 change: 0 additions & 1 deletion repositories/centos-10.json

This file was deleted.

1 change: 0 additions & 1 deletion repositories/centos-9.json

This file was deleted.

66 changes: 0 additions & 66 deletions repositories/centos-stream-10.json

This file was deleted.

1 change: 1 addition & 0 deletions repositories/centos-stream-10.json
Loading
Loading