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:
Tomáš Hozza 2024-01-08 17:58:49 +01:00 committed by Achilleas Koutsou
parent f6ff8c40dd
commit 625b1578fa
1166 changed files with 154457 additions and 5508 deletions

View file

@ -1,14 +0,0 @@
package distro_mock
import (
"github.com/osbuild/images/pkg/distro/test_distro"
"github.com/osbuild/images/pkg/distroregistry"
)
func NewDefaultRegistry() (*distroregistry.Registry, error) {
testDistro := test_distro.New()
if testDistro == nil {
panic("Attempt to register test distro failed")
}
return distroregistry.New(nil, testDistro)
}

View file

@ -10,7 +10,7 @@ import (
"github.com/osbuild/osbuild-composer/internal/worker"
)
type FixtureGenerator func(tmpdir string) Fixture
type FixtureGenerator func(tmpdir, hostDistroName, hostArchName string) Fixture
func createBaseWorkersFixture(tmpdir string) *worker.Server {
q, err := fsjobqueue.New(tmpdir)
@ -20,55 +20,55 @@ func createBaseWorkersFixture(tmpdir string) *worker.Server {
return worker.NewServer(nil, q, worker.Config{BasePath: "/api/worker/v1"})
}
func BaseFixture(tmpdir string) Fixture {
func BaseFixture(tmpdir, hostDistroName, hostArchName string) Fixture {
return Fixture{
store.FixtureBase(),
store.FixtureBase(hostDistroName, hostArchName),
createBaseWorkersFixture(tmpdir),
dnfjson_mock.Base,
}
}
func NoComposesFixture(tmpdir string) Fixture {
func NoComposesFixture(tmpdir, hostDistroName, hostArchName string) Fixture {
return Fixture{
store.FixtureEmpty(),
store.FixtureEmpty(hostDistroName, hostArchName),
createBaseWorkersFixture(tmpdir),
dnfjson_mock.Base,
}
}
func NonExistingPackage(tmpdir string) Fixture {
func NonExistingPackage(tmpdir, hostDistroName, hostArchName string) Fixture {
return Fixture{
store.FixtureBase(),
store.FixtureBase(hostDistroName, hostArchName),
createBaseWorkersFixture(tmpdir),
dnfjson_mock.NonExistingPackage,
}
}
func BadDepsolve(tmpdir string) Fixture {
func BadDepsolve(tmpdir, hostDistroName, hostArchName string) Fixture {
return Fixture{
store.FixtureBase(),
store.FixtureBase(hostDistroName, hostArchName),
createBaseWorkersFixture(tmpdir),
dnfjson_mock.BadDepsolve,
}
}
func BadFetch(tmpdir string) Fixture {
func BadFetch(tmpdir, hostDistroName, hostArchName string) Fixture {
return Fixture{
store.FixtureBase(),
store.FixtureBase(hostDistroName, hostArchName),
createBaseWorkersFixture(tmpdir),
dnfjson_mock.BadFetch,
}
}
func OldChangesFixture(tmpdir string) Fixture {
func OldChangesFixture(tmpdir, hostDistroName, hostArchName string) Fixture {
return Fixture{
store.FixtureOldChanges(),
store.FixtureOldChanges(hostDistroName, hostArchName),
createBaseWorkersFixture(tmpdir),
dnfjson_mock.Base,
}
}
func BadJobJSONFixture(tmpdir string) Fixture {
func BadJobJSONFixture(tmpdir, hostDistroName, hostArchName string) Fixture {
err := os.Mkdir(path.Join(tmpdir, "/jobs"), 0755)
if err != nil {
panic(err)
@ -79,7 +79,7 @@ func BadJobJSONFixture(tmpdir string) Fixture {
}
return Fixture{
store.FixtureJobs(),
store.FixtureJobs(hostDistroName, hostArchName),
createBaseWorkersFixture(path.Join(tmpdir, "/jobs")),
dnfjson_mock.Base,
}

View file

@ -7,7 +7,7 @@ import (
)
type Fixture struct {
*store.Store
Workers *worker.Server
StoreFixture *store.Fixture
Workers *worker.Server
dnfjson_mock.ResponseGenerator
}