Port osbuild/images v0.33.0 with dot-notation to composer
Update the osbuild/images to the version which introduces "dot notation" for distro release versions. - Replace all uses of distroregistry by distrofactory. - Delete local version of reporegistry and use the one from the osbuild/images. - Weldr: unify `createWeldrAPI()` and `createWeldrAPI2()` into a single `createTestWeldrAPI()` function`. - store/fixture: rework fixtures to allow overriding the host distro name and host architecture name. A cleanup function to restore the host distro and arch names is always part of the fixture struct. - Delete `distro_mock` package, since it is no longer used. - Bump the required version of osbuild to 98, because the OSCAP customization is using the 'compress_results' stage option, which is not available in older versions of osbuild. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
f6ff8c40dd
commit
625b1578fa
1166 changed files with 154457 additions and 5508 deletions
|
|
@ -15,12 +15,13 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/osbuild/images/pkg/blueprint"
|
||||
"github.com/osbuild/images/pkg/container"
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
"github.com/osbuild/images/pkg/distroregistry"
|
||||
"github.com/osbuild/images/pkg/distrofactory"
|
||||
"github.com/osbuild/images/pkg/manifest"
|
||||
"github.com/osbuild/images/pkg/ostree"
|
||||
"github.com/osbuild/images/pkg/rhsm/facts"
|
||||
|
|
@ -208,6 +209,15 @@ func makeManifestJob(name string, imgType distro.ImageType, cr composeRequest, d
|
|||
|
||||
type DistroArchRepoMap map[string]map[string][]repository
|
||||
|
||||
func (darm DistroArchRepoMap) ListDistros() []string {
|
||||
distros := make([]string, 0, len(darm))
|
||||
for d := range darm {
|
||||
distros = append(distros, d)
|
||||
}
|
||||
sort.Strings(distros)
|
||||
return distros
|
||||
}
|
||||
|
||||
func convertRepo(r repository) rpmmd.RepoConfig {
|
||||
var urls []string
|
||||
if r.BaseURL != "" {
|
||||
|
|
@ -447,7 +457,7 @@ func main() {
|
|||
|
||||
seedArg := int64(0)
|
||||
darm := readRepos()
|
||||
distroReg := distroregistry.NewDefault()
|
||||
distroFac := distrofactory.NewDefault()
|
||||
jobs := make([]manifestJob, 0)
|
||||
|
||||
requestMap := loadFormatRequestMap()
|
||||
|
|
@ -459,10 +469,10 @@ func main() {
|
|||
|
||||
fmt.Println("Collecting jobs")
|
||||
if len(distros) == 0 {
|
||||
distros = distroReg.List()
|
||||
distros = darm.ListDistros()
|
||||
}
|
||||
for _, distroName := range distros {
|
||||
distribution := distroReg.GetDistro(distroName)
|
||||
distribution := distroFac.GetDistro(distroName)
|
||||
if distribution == nil {
|
||||
fmt.Fprintf(os.Stderr, "invalid distro name %q\n", distroName)
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/pkg/jobqueue"
|
||||
"github.com/osbuild/osbuild-composer/pkg/jobqueue/dbjobqueue"
|
||||
|
||||
"github.com/osbuild/images/pkg/distroregistry"
|
||||
"github.com/osbuild/images/pkg/distrofactory"
|
||||
"github.com/osbuild/osbuild-composer/internal/auth"
|
||||
"github.com/osbuild/osbuild-composer/internal/cloudapi"
|
||||
v2 "github.com/osbuild/osbuild-composer/internal/cloudapi/v2"
|
||||
|
|
@ -36,7 +36,7 @@ type Composer struct {
|
|||
stateDir string
|
||||
cacheDir string
|
||||
logger *log.Logger
|
||||
distros *distroregistry.Registry
|
||||
distros *distrofactory.Factory
|
||||
|
||||
solver *dnfjson.BaseSolver
|
||||
|
||||
|
|
@ -68,11 +68,11 @@ func NewComposer(config *ComposerConfigFile, stateDir, cacheDir string) (*Compos
|
|||
}
|
||||
}
|
||||
|
||||
c.distros = distroregistry.NewDefault()
|
||||
logrus.Infof("Loaded %d distros", len(c.distros.List()))
|
||||
c.distros = distrofactory.NewDefault()
|
||||
|
||||
// TODO: Move this to Weldr API initialization
|
||||
// Clean up the cache, removes unknown distros and files
|
||||
dnfjson.CleanupOldCacheDirs(path.Join(c.cacheDir, "rpmmd"), c.distros.List())
|
||||
// dnfjson.CleanupOldCacheDirs(path.Join(c.cacheDir, "rpmmd"), c.distros.List())
|
||||
|
||||
c.solver = dnfjson.NewBaseSolver(path.Join(c.cacheDir, "rpmmd"))
|
||||
c.solver.SetDNFJSONPath(c.config.DNFJson)
|
||||
|
|
|
|||
|
|
@ -13,8 +13,9 @@ import (
|
|||
"github.com/osbuild/images/pkg/arch"
|
||||
"github.com/osbuild/images/pkg/blueprint"
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
rhel "github.com/osbuild/images/pkg/distro/rhel8"
|
||||
"github.com/osbuild/images/pkg/distro/rhel9"
|
||||
"github.com/osbuild/images/pkg/ostree"
|
||||
"github.com/osbuild/images/pkg/reporegistry"
|
||||
"github.com/osbuild/images/pkg/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/dnfjson"
|
||||
)
|
||||
|
|
@ -27,13 +28,14 @@ func TestCrossArchDepsolve(t *testing.T) {
|
|||
repoDir := "/usr/share/tests/osbuild-composer"
|
||||
|
||||
// NOTE: we can add RHEL, but don't make it hard requirement because it will fail outside of VPN
|
||||
cs9 := rhel.NewCentos()
|
||||
cs9 := rhel9.DistroFactory("centos-9")
|
||||
require.NotNil(t, cs9)
|
||||
|
||||
// Set up temporary directory for rpm/dnf cache
|
||||
dir := t.TempDir()
|
||||
baseSolver := dnfjson.NewBaseSolver(dir)
|
||||
|
||||
repos, err := rpmmd.LoadRepositories([]string{repoDir}, cs9.Name())
|
||||
repos, err := reporegistry.LoadRepositories([]string{repoDir}, cs9.Name())
|
||||
require.NoErrorf(t, err, "Failed to LoadRepositories %v", cs9.Name())
|
||||
|
||||
for _, archStr := range cs9.ListArches() {
|
||||
|
|
@ -81,13 +83,14 @@ func TestDepsolvePackageSets(t *testing.T) {
|
|||
repoDir := "/usr/share/tests/osbuild-composer"
|
||||
|
||||
// NOTE: we can add RHEL, but don't make it hard requirement because it will fail outside of VPN
|
||||
cs9 := rhel.NewCentos()
|
||||
cs9 := rhel9.DistroFactory("centos-9")
|
||||
require.NotNil(t, cs9)
|
||||
|
||||
// Set up temporary directory for rpm/dnf cache
|
||||
dir := t.TempDir()
|
||||
solver := dnfjson.NewSolver(cs9.ModulePlatformID(), cs9.Releasever(), arch.ARCH_X86_64.String(), cs9.Name(), dir)
|
||||
|
||||
repos, err := rpmmd.LoadRepositories([]string{repoDir}, cs9.Name())
|
||||
repos, err := reporegistry.LoadRepositories([]string{repoDir}, cs9.Name())
|
||||
require.NoErrorf(t, err, "Failed to LoadRepositories %v", cs9.Name())
|
||||
x86Repos, ok := repos[arch.ARCH_X86_64.String()]
|
||||
require.Truef(t, ok, "failed to get %q repos for %q", arch.ARCH_X86_64.String(), cs9.Name())
|
||||
|
|
|
|||
|
|
@ -12,8 +12,9 @@ import (
|
|||
"github.com/osbuild/images/pkg/arch"
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
"github.com/osbuild/images/pkg/distro/fedora"
|
||||
"github.com/osbuild/images/pkg/distroregistry"
|
||||
"github.com/osbuild/images/pkg/distrofactory"
|
||||
"github.com/osbuild/images/pkg/manifest"
|
||||
"github.com/osbuild/images/pkg/reporegistry"
|
||||
"github.com/osbuild/images/pkg/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/dnfjson"
|
||||
|
|
@ -126,7 +127,9 @@ func main() {
|
|||
awsTarget.Created = time.Now()
|
||||
awsTarget.OsbuildArtifact.ExportFilename = "image.ami"
|
||||
|
||||
d := fedora.NewF37()
|
||||
const fedoraID = "fedora-37"
|
||||
|
||||
d := fedora.DistroFactory(fedoraID)
|
||||
a, err := d.GetArch(arch.ARCH_X86_64.String())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
|
@ -139,7 +142,7 @@ func main() {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
allRepos, err := rpmmd.LoadRepositories([]string{cwd}, "fedora-37")
|
||||
allRepos, err := reporegistry.LoadRepositories([]string{cwd}, fedoraID)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -150,8 +153,9 @@ func main() {
|
|||
}
|
||||
rpmmdCache := path.Join(homeDir, ".cache/osbuild-composer/rpmmd")
|
||||
|
||||
dr, _ := distroregistry.New(d, nil)
|
||||
s := store.New(&cwd, dr, nil)
|
||||
df := distrofactory.New(fedora.DistroFactory)
|
||||
|
||||
s := store.New(&cwd, df, nil)
|
||||
if s == nil {
|
||||
panic("could not create store")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ func (impl *ContainerResolveJobImpl) Run(job worker.Job) error {
|
|||
resolver.AuthFilePath = impl.AuthFilePath
|
||||
|
||||
for _, s := range args.Specs {
|
||||
resolver.Add(container.SourceSpec{s.Source, s.Name, s.TLSVerify})
|
||||
resolver.Add(container.SourceSpec{s.Source, s.Name, nil, s.TLSVerify, nil, nil})
|
||||
}
|
||||
|
||||
specs, err := resolver.Finish()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue