many: update images Manifest() API for PR#1107
This updates composer to use the updated API in images around the seed handling for manifests, see images PR#1107 for details. Note that this has no semantic changes yet. We could now simplfy some things because images will auto-seed but that is for a followup.
This commit is contained in:
parent
9dd8b2c50f
commit
af0543d27c
10 changed files with 28 additions and 28 deletions
|
|
@ -161,7 +161,7 @@ func makeManifestJob(name string, imgType distro.ImageType, cr composeRequest, d
|
|||
}
|
||||
}
|
||||
|
||||
manifest, _, err := imgType.Manifest(&bp, options, repos, seedArg)
|
||||
manifest, _, err := imgType.Manifest(&bp, options, repos, &seedArg)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("[%s] failed: %s", filename, err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ func TestCrossArchDepsolve(t *testing.T) {
|
|||
Customizations: customizations,
|
||||
},
|
||||
options,
|
||||
repos[archStr], 0)
|
||||
repos[archStr], nil)
|
||||
assert.NoError(t, err)
|
||||
|
||||
for _, set := range manifest.GetPackageSetChains() {
|
||||
|
|
@ -105,7 +105,7 @@ func TestDepsolvePackageSets(t *testing.T) {
|
|||
qcow2Image, err := x86Arch.GetImageType(qcow2ImageTypeName)
|
||||
require.Nilf(t, err, "failed to get %q image type of %q/%q distro/arch", qcow2ImageTypeName, cs9.Name(), arch.ARCH_X86_64.String())
|
||||
|
||||
manifestSource, _, err := qcow2Image.Manifest(&blueprint.Blueprint{Packages: []blueprint.Package{{Name: "bind"}}}, distro.ImageOptions{}, x86Repos, 0)
|
||||
manifestSource, _, err := qcow2Image.Manifest(&blueprint.Blueprint{Packages: []blueprint.Package{{Name: "bind"}}}, distro.ImageOptions{}, x86Repos, nil)
|
||||
require.Nilf(t, err, "failed to initialise manifest for %q image type of %q/%q distro/arch", qcow2ImageTypeName, cs9.Name(), arch.ARCH_X86_64.String())
|
||||
imagePkgSets := manifestSource.GetPackageSetChains()
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import (
|
|||
|
||||
func getManifest(bp blueprint.Blueprint, t distro.ImageType, a distro.Arch, d distro.Distro, cacheDir string, repos []rpmmd.RepoConfig) (manifest.OSBuildManifest, []rpmmd.PackageSpec) {
|
||||
ibp := blueprint.Convert(bp)
|
||||
manifest, _, err := t.Manifest(&ibp, distro.ImageOptions{}, repos, 0)
|
||||
manifest, _, err := t.Manifest(&ibp, distro.ImageOptions{}, repos, nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ func (s *Server) enqueueCompose(irs []imageRequest, channel string) (uuid.UUID,
|
|||
arch := ir.imageType.Arch()
|
||||
distribution := arch.Distro()
|
||||
|
||||
manifestSource, _, err := ir.imageType.Manifest(&ibp, ir.imageOptions, ir.repositories, ir.manifestSeed)
|
||||
manifestSource, _, err := ir.imageType.Manifest(&ibp, ir.imageOptions, ir.repositories, &ir.manifestSeed)
|
||||
if err != nil {
|
||||
logrus.Warningf("ErrorEnqueueingJob, failed generating manifest: %v", err)
|
||||
return id, HTTPErrorWithInternal(ErrorEnqueueingJob, err)
|
||||
|
|
@ -287,14 +287,14 @@ func (s *Server) enqueueKojiCompose(taskID uint64, server, name, version, releas
|
|||
|
||||
var kojiFilenames []string
|
||||
var buildIDs []uuid.UUID
|
||||
for _, ir := range irs {
|
||||
for idx, ir := range irs {
|
||||
ibp := blueprint.Convert(ir.blueprint)
|
||||
|
||||
// shortcuts
|
||||
arch := ir.imageType.Arch()
|
||||
distribution := arch.Distro()
|
||||
|
||||
manifestSource, _, err := ir.imageType.Manifest(&ibp, ir.imageOptions, ir.repositories, ir.manifestSeed)
|
||||
manifestSource, _, err := ir.imageType.Manifest(&ibp, ir.imageOptions, ir.repositories, &irs[idx].manifestSeed)
|
||||
if err != nil {
|
||||
logrus.Errorf("ErrorEnqueueingJob, failed generating manifest: %v", err)
|
||||
return id, HTTPErrorWithInternal(ErrorEnqueueingJob, err)
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ func FixtureBase(hostDistroName, hostArchName string) *Fixture {
|
|||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to get image type %s for a test distro architecture: %v", test_distro.TestImageTypeName, err))
|
||||
}
|
||||
manifest, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, 0)
|
||||
manifest, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, nil)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to create a manifest: %v", err))
|
||||
}
|
||||
|
|
@ -231,7 +231,7 @@ func FixtureFinished(hostDistroName, hostArchName string) *Fixture {
|
|||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to get image type %s for a test distro architecture: %v", test_distro.TestImageTypeName, err))
|
||||
}
|
||||
manifest, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, 0)
|
||||
manifest, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, nil)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to create a manifest: %v", err))
|
||||
}
|
||||
|
|
@ -465,7 +465,7 @@ func FixtureJobs(hostDistroName, hostArchName string) *Fixture {
|
|||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to get image type %s for a test distro architecture: %v", test_distro.TestImageTypeName, err))
|
||||
}
|
||||
manifest, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, 0)
|
||||
manifest, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, nil)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to create a manifest: %v", err))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ func (suite *storeTest) SetupSuite() {
|
|||
suite.myImageType, err = suite.myArch.GetImageType(test_distro.TestImageTypeName)
|
||||
suite.NoError(err)
|
||||
ibp := blueprint.Convert(suite.myBP)
|
||||
manifest, _, _ := suite.myImageType.Manifest(&ibp, suite.myImageOptions, suite.myRepoConfig, 0)
|
||||
manifest, _, _ := suite.myImageType.Manifest(&ibp, suite.myImageOptions, suite.myRepoConfig, nil)
|
||||
suite.myManifest, _ = manifest.Serialize(nil, nil, nil, nil)
|
||||
suite.mySourceConfig = SourceConfig{
|
||||
Name: "testSourceConfig",
|
||||
|
|
|
|||
|
|
@ -2567,7 +2567,7 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request
|
|||
}
|
||||
|
||||
ibp := blueprint.Convert(*bp)
|
||||
manifest, warnings, err := imageType.Manifest(&ibp, options, imageRepos, seed)
|
||||
manifest, warnings, err := imageType.Manifest(&ibp, options, imageRepos, &seed)
|
||||
if err != nil {
|
||||
errors := responseError{
|
||||
ID: "ManifestCreationFailed",
|
||||
|
|
|
|||
|
|
@ -1001,7 +1001,7 @@ func TestCompose(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
imgType, err := arch.GetImageType(test_distro.TestImageTypeName)
|
||||
require.NoError(t, err)
|
||||
manifest, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, 0)
|
||||
manifest, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
rPkgs, rContainers, rCommits := ResolveContent(manifest.GetPackageSetChains(), manifest.GetContainerSourceSpecs(), manifest.GetOSTreeSourceSpecs())
|
||||
|
|
@ -1012,7 +1012,7 @@ func TestCompose(t *testing.T) {
|
|||
ostreeImgType, err := arch.GetImageType(test_distro.TestImageTypeOSTree)
|
||||
require.NoError(t, err)
|
||||
ostreeOptions := ostree.ImageOptions{URL: ostreeRepoDefault.Server.URL}
|
||||
ostreeManifest, _, err := ostreeImgType.Manifest(nil, distro.ImageOptions{OSTree: &ostreeOptions}, nil, 0)
|
||||
ostreeManifest, _, err := ostreeImgType.Manifest(nil, distro.ImageOptions{OSTree: &ostreeOptions}, nil, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
rPkgs, rContainers, rCommits = ResolveContent(ostreeManifest.GetPackageSetChains(), ostreeManifest.GetContainerSourceSpecs(), ostreeManifest.GetOSTreeSourceSpecs())
|
||||
|
|
@ -1123,7 +1123,7 @@ func TestCompose(t *testing.T) {
|
|||
}
|
||||
|
||||
ostreeOptionsOther := ostree.ImageOptions{ImageRef: otherRef, URL: ostreeRepoOther.Server.URL}
|
||||
ostreeManifestOther, _, err := ostreeImgType.Manifest(nil, distro.ImageOptions{OSTree: &ostreeOptionsOther}, nil, 0)
|
||||
ostreeManifestOther, _, err := ostreeImgType.Manifest(nil, distro.ImageOptions{OSTree: &ostreeOptionsOther}, nil, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
rPkgs, rContainers, rCommits = ResolveContent(ostreeManifestOther.GetPackageSetChains(), ostreeManifestOther.GetContainerSourceSpecs(), ostreeManifestOther.GetOSTreeSourceSpecs())
|
||||
|
|
@ -1166,7 +1166,7 @@ func TestCompose(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
imgType2, err := arch2.GetImageType(test_distro.TestImageTypeName)
|
||||
require.NoError(t, err)
|
||||
manifest2, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, 0)
|
||||
manifest2, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
rPkgs, rContainers, rCommits = ResolveContent(manifest2.GetPackageSetChains(), manifest2.GetContainerSourceSpecs(), manifest2.GetOSTreeSourceSpecs())
|
||||
|
|
@ -2204,7 +2204,7 @@ func TestComposePOST_ImageTypeDenylist(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
imgType2, err := arch.GetImageType(test_distro.TestImageType2Name)
|
||||
require.NoError(t, err)
|
||||
manifest, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, 0)
|
||||
manifest, _, err := imgType.Manifest(nil, distro.ImageOptions{}, nil, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
rPkgs, rContainers, rCommits := ResolveContent(manifest.GetPackageSetChains(), manifest.GetContainerSourceSpecs(), manifest.GetOSTreeSourceSpecs())
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ func TestComposeStatusFromLegacyError(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error getting image type from arch: %v", err)
|
||||
}
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, 0)
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("error creating osbuild manifest: %v", err)
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ func TestComposeStatusFromJobError(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error getting image type from arch: %v", err)
|
||||
}
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, 0)
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("error creating osbuild manifest: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ func TestCreate(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error getting image type from arch: %v", err)
|
||||
}
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, 0)
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("error creating osbuild manifest: %v", err)
|
||||
}
|
||||
|
|
@ -178,7 +178,7 @@ func TestCancel(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error getting image type from arch: %v", err)
|
||||
}
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, 0)
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("error creating osbuild manifest: %v", err)
|
||||
}
|
||||
|
|
@ -222,7 +222,7 @@ func TestUpdate(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error getting image type from arch: %v", err)
|
||||
}
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, 0)
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("error creating osbuild manifest: %v", err)
|
||||
}
|
||||
|
|
@ -261,7 +261,7 @@ func TestArgs(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
imageType, err := arch.GetImageType(test_distro.TestImageTypeName)
|
||||
require.NoError(t, err)
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, 0)
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
mf, err := manifest.Serialize(nil, nil, nil, nil)
|
||||
|
|
@ -310,7 +310,7 @@ func TestUpload(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error getting image type from arch: %v", err)
|
||||
}
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, 0)
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("error creating osbuild manifest: %v", err)
|
||||
}
|
||||
|
|
@ -346,7 +346,7 @@ func TestUploadNotAcceptingArtifacts(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error getting image type from arch: %v", err)
|
||||
}
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, 0)
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("error creating osbuild manifest: %v", err)
|
||||
}
|
||||
|
|
@ -380,7 +380,7 @@ func TestUploadAlteredBasePath(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error getting image type from arch: %v", err)
|
||||
}
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, 0)
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("error creating osbuild manifest: %v", err)
|
||||
}
|
||||
|
|
@ -1554,7 +1554,7 @@ func TestRequestJobForWorker(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error getting image type from arch: %v", err)
|
||||
}
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, 0)
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("error creating osbuild manifest: %v", err)
|
||||
}
|
||||
|
|
@ -1589,7 +1589,7 @@ func TestJobHeartbeats(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error getting image type from arch: %v", err)
|
||||
}
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, 0)
|
||||
manifest, _, err := imageType.Manifest(nil, distro.ImageOptions{Size: imageType.Size(0)}, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("error creating osbuild manifest: %v", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue