distro: pass entire Blueprint to Manifest()

Pass the entire Blueprint to Manifest() instead of just the
Customizations.  The goal is to combine the functionality of the
ImageType.PackageSets() and ImageType.Manifest() methods into one call.
This commit is contained in:
Achilleas Koutsou 2023-05-09 20:16:33 +02:00 committed by Simon de Vlieger
parent 30c5093fb5
commit 1a38939abf
18 changed files with 62 additions and 84 deletions

View file

@ -181,7 +181,7 @@ func (s *Server) enqueueCompose(distribution distro.Distro, bp blueprint.Bluepri
s.goroutinesGroup.Add(1)
go func() {
generateManifest(s.goroutinesCtx, s.workers, depsolveJobID, containerResolveJob, ostreeResolveJobID, manifestJobID, ir.imageType, ir.repositories, ir.imageOptions, manifestSeed, bp.Customizations)
generateManifest(s.goroutinesCtx, s.workers, depsolveJobID, containerResolveJob, ostreeResolveJobID, manifestJobID, ir.imageType, ir.repositories, ir.imageOptions, manifestSeed, &bp)
defer s.goroutinesGroup.Done()
}()
@ -304,7 +304,7 @@ func (s *Server) enqueueKojiCompose(taskID uint64, server, name, version, releas
// copy the image request while passing it into the goroutine to prevent data races
s.goroutinesGroup.Add(1)
go func(ir imageRequest) {
generateManifest(s.goroutinesCtx, s.workers, depsolveJobID, containerResolveJob, ostreeResolveJobID, manifestJobID, ir.imageType, ir.repositories, ir.imageOptions, manifestSeed, bp.Customizations)
generateManifest(s.goroutinesCtx, s.workers, depsolveJobID, containerResolveJob, ostreeResolveJobID, manifestJobID, ir.imageType, ir.repositories, ir.imageOptions, manifestSeed, &bp)
defer s.goroutinesGroup.Done()
}(ir)
}
@ -325,7 +325,7 @@ func (s *Server) enqueueKojiCompose(taskID uint64, server, name, version, releas
return id, nil
}
func generateManifest(ctx context.Context, workers *worker.Server, depsolveJobID, containerResolveJobID, ostreeResolveJobID, manifestJobID uuid.UUID, imageType distro.ImageType, repos []rpmmd.RepoConfig, options distro.ImageOptions, seed int64, b *blueprint.Customizations) {
func generateManifest(ctx context.Context, workers *worker.Server, depsolveJobID, containerResolveJobID, ostreeResolveJobID, manifestJobID uuid.UUID, imageType distro.ImageType, repos []rpmmd.RepoConfig, options distro.ImageOptions, seed int64, b *blueprint.Blueprint) {
ctx, cancel := context.WithTimeout(ctx, time.Minute*5)
defer cancel()

View file

@ -133,7 +133,7 @@ type ImageType interface {
// specified in the given blueprint; it also returns any warnings (e.g.
// deprecation notices) generated by the manifest.
// The packageSpecSets must be labelled in the same way as the originating PackageSets.
Manifest(b *blueprint.Customizations, options ImageOptions, repos []rpmmd.RepoConfig, packageSpecSets map[string][]rpmmd.PackageSpec, containers []container.Spec, seed int64) (*manifest.Manifest, []string, error)
Manifest(bp *blueprint.Blueprint, options ImageOptions, repos []rpmmd.RepoConfig, packageSpecSets map[string][]rpmmd.PackageSpec, containers []container.Spec, seed int64) (*manifest.Manifest, []string, error)
}
// The ImageOptions specify options for a specific image build

View file

@ -155,7 +155,7 @@ func TestImageTypePipelineNames(t *testing.T) {
packageSets[plName] = minimalPackageSet
}
m, _, err := imageType.Manifest(bp.Customizations, options, repos, packageSets, containers, seed)
m, _, err := imageType.Manifest(&bp, options, repos, packageSets, containers, seed)
require.NoError(err)
mf, err := m.Serialize(packageSets)
require.NoError(err)

View file

@ -144,7 +144,7 @@ func TestDistro_Manifest(t *testing.T, pipelinePath string, prefix string, regis
imgPackageSpecSets = tt.PackageSpecSets
}
manifest, _, err := imageType.Manifest(tt.ComposeRequest.Blueprint.Customizations,
manifest, _, err := imageType.Manifest(tt.ComposeRequest.Blueprint,
options,
repos,
imgPackageSpecSets,

View file

@ -426,7 +426,7 @@ func TestDistro_ManifestError(t *testing.T) {
Size: imgType.Size(0),
}
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, imgOpts, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, imgOpts, nil, testPackageSpecSets, nil, 0)
if imgTypeName == "iot-commit" || imgTypeName == "iot-container" {
assert.EqualError(t, err, "kernel boot parameter customizations are not supported for ostree types")
} else if imgTypeName == "iot-installer" {
@ -576,7 +576,7 @@ func TestDistro_CustomFileSystemManifestError(t *testing.T) {
arch, _ := fedoraDistro.GetArch(archName)
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
if imgTypeName == "iot-commit" || imgTypeName == "iot-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if imgTypeName == "iot-raw-image" {
@ -607,7 +607,7 @@ func TestDistro_TestRootMountPoint(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
if imgTypeName == "iot-commit" || imgTypeName == "iot-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if imgTypeName == "iot-raw-image" {
@ -642,7 +642,7 @@ func TestDistro_CustomFileSystemSubDirectories(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
if strings.HasPrefix(imgTypeName, "iot-") || strings.HasPrefix(imgTypeName, "image-") {
continue
} else {
@ -681,7 +681,7 @@ func TestDistro_MountpointsWithArbitraryDepthAllowed(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
if strings.HasPrefix(imgTypeName, "iot-") || strings.HasPrefix(imgTypeName, "image-") {
continue
} else {
@ -715,7 +715,7 @@ func TestDistro_DirtyMountpointsNotAllowed(t *testing.T) {
arch, _ := fedoraDistro.GetArch(archName)
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
if strings.HasPrefix(imgTypeName, "iot-") || strings.HasPrefix(imgTypeName, "image-") {
continue
} else {
@ -745,7 +745,7 @@ func TestDistro_CustomFileSystemPatternMatching(t *testing.T) {
arch, _ := fedoraDistro.GetArch(archName)
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
if imgTypeName == "iot-commit" || imgTypeName == "iot-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if imgTypeName == "iot-raw-image" {
@ -776,7 +776,7 @@ func TestDistro_CustomUsrPartitionNotLargeEnough(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
if imgTypeName == "iot-commit" || imgTypeName == "iot-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if imgTypeName == "iot-raw-image" {

View file

@ -257,20 +257,13 @@ func (t *imageType) PartitionType() string {
return basePartitionTable.Type
}
func (t *imageType) Manifest(customizations *blueprint.Customizations,
func (t *imageType) Manifest(bp *blueprint.Blueprint,
options distro.ImageOptions,
repos []rpmmd.RepoConfig,
packageSpecs map[string][]rpmmd.PackageSpec,
containers []container.Spec,
seed int64) (*manifest.Manifest, []string, error) {
bp := &blueprint.Blueprint{Name: "empty blueprint"}
err := bp.Initialize()
if err != nil {
panic("could not initialize empty blueprint: " + err.Error())
}
bp.Customizations = customizations
// the os pipeline filters repos based on the `osPkgsKey` package set, merge the repos which
// contain a payload package set into the `osPkgsKey`, so those repos are included when
// building the rpm stage in the os pipeline

View file

@ -178,7 +178,7 @@ func TestDistro_ManifestError(t *testing.T) {
Size: imgType.Size(0),
}
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, imgOpts, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, imgOpts, nil, testPackageSpecSets, nil, 0)
assert.NoError(t, err)
}
}
@ -284,7 +284,7 @@ func TestDistro_CustomFileSystemManifestError(t *testing.T) {
arch, _ := r7distro.GetArch(archName)
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
assert.EqualError(t, err, "The following custom mountpoints are not supported [\"/etc\"]")
}
}
@ -307,7 +307,7 @@ func TestDistro_TestRootMountPoint(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
assert.NoError(t, err)
}
}
@ -334,7 +334,7 @@ func TestDistro_CustomFileSystemSubDirectories(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
assert.NoError(t, err)
}
}
@ -369,7 +369,7 @@ func TestDistro_MountpointsWithArbitraryDepthAllowed(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
assert.NoError(t, err)
}
}
@ -399,7 +399,7 @@ func TestDistro_DirtyMountpointsNotAllowed(t *testing.T) {
arch, _ := r7distro.GetArch(archName)
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
assert.EqualError(t, err, "The following custom mountpoints are not supported [\"//\" \"/var//\" \"/var//log/audit/\"]")
}
}
@ -425,7 +425,7 @@ func TestDistro_CustomFileSystemPatternMatching(t *testing.T) {
arch, _ := r7distro.GetArch(archName)
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
assert.EqualError(t, err, "The following custom mountpoints are not supported [\"/variable\" \"/variable/log/audit\"]")
}
}
@ -448,7 +448,7 @@ func TestDistro_CustomUsrPartitionNotLargeEnough(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
assert.NoError(t, err)
}
}

View file

@ -149,20 +149,13 @@ func (t *imageType) PartitionType() string {
return basePartitionTable.Type
}
func (t *imageType) Manifest(customizations *blueprint.Customizations,
func (t *imageType) Manifest(bp *blueprint.Blueprint,
options distro.ImageOptions,
repos []rpmmd.RepoConfig,
packageSpecs map[string][]rpmmd.PackageSpec,
containers []container.Spec,
seed int64) (*manifest.Manifest, []string, error) {
bp := &blueprint.Blueprint{Name: "empty blueprint"}
err := bp.Initialize()
if err != nil {
panic("could not initialize empty blueprint: " + err.Error())
}
bp.Customizations = customizations
// the os pipeline filters repos based on the `osPkgsKey` package set, merge the repos which
// contain a payload package set into the `osPkgsKey`, so those repos are included when
// building the rpm stage in the os pipeline

View file

@ -474,7 +474,7 @@ func TestDistro_ManifestError(t *testing.T) {
Size: imgType.Size(0),
}
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, imgOpts, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, imgOpts, nil, testPackageSpecSets, nil, 0)
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
assert.EqualError(t, err, "kernel boot parameter customizations are not supported for ostree types")
} else if imgTypeName == "edge-raw-image" {
@ -657,7 +657,7 @@ func TestDistro_CustomFileSystemManifestError(t *testing.T) {
arch, _ := r8distro.GetArch(archName)
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if unsupported[imgTypeName] {
@ -692,7 +692,7 @@ func TestDistro_TestRootMountPoint(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if unsupported[imgTypeName] {
@ -733,7 +733,7 @@ func TestDistro_CustomFileSystemSubDirectories(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
if unsupported[imgTypeName] {
assert.Error(t, err)
} else {
@ -780,7 +780,7 @@ func TestDistro_MountpointsWithArbitraryDepthAllowed(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
if unsupported[imgTypeName] {
assert.Error(t, err)
} else {
@ -822,7 +822,7 @@ func TestDistro_DirtyMountpointsNotAllowed(t *testing.T) {
arch, _ := r8distro.GetArch(archName)
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
if unsupported[imgTypeName] {
assert.Error(t, err)
} else {
@ -858,7 +858,7 @@ func TestDistro_CustomFileSystemPatternMatching(t *testing.T) {
arch, _ := r8distro.GetArch(archName)
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if unsupported[imgTypeName] {
@ -893,7 +893,7 @@ func TestDistro_CustomUsrPartitionNotLargeEnough(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if unsupported[imgTypeName] {

View file

@ -183,20 +183,13 @@ func (t *imageType) PartitionType() string {
return basePartitionTable.Type
}
func (t *imageType) Manifest(customizations *blueprint.Customizations,
func (t *imageType) Manifest(bp *blueprint.Blueprint,
options distro.ImageOptions,
repos []rpmmd.RepoConfig,
packageSpecs map[string][]rpmmd.PackageSpec,
containers []container.Spec,
seed int64) (*manifest.Manifest, []string, error) {
bp := &blueprint.Blueprint{Name: "empty blueprint"}
err := bp.Initialize()
if err != nil {
panic("could not initialize empty blueprint: " + err.Error())
}
bp.Customizations = customizations
// the os pipeline filters repos based on the `osPkgsKey` package set, merge the repos which
// contain a payload package set into the `osPkgsKey`, so those repos are included when
// building the rpm stage in the os pipeline

View file

@ -457,7 +457,7 @@ func TestDistro_ManifestError(t *testing.T) {
Size: imgType.Size(0),
}
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, imgOpts, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, imgOpts, nil, testPackageSpecSets, nil, 0)
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
assert.EqualError(t, err, "kernel boot parameter customizations are not supported for ostree types")
} else if imgTypeName == "edge-raw-image" {
@ -630,7 +630,7 @@ func TestDistro_CustomFileSystemManifestError(t *testing.T) {
arch, _ := r9distro.GetArch(archName)
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if imgTypeName == "edge-installer" || imgTypeName == "edge-simplified-installer" || imgTypeName == "edge-raw-image" {
@ -659,7 +659,7 @@ func TestDistro_TestRootMountPoint(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if imgTypeName == "edge-installer" || imgTypeName == "edge-simplified-installer" || imgTypeName == "edge-raw-image" {
@ -692,7 +692,7 @@ func TestDistro_CustomFileSystemSubDirectories(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
if strings.HasPrefix(imgTypeName, "edge-") {
continue
} else {
@ -731,7 +731,7 @@ func TestDistro_MountpointsWithArbitraryDepthAllowed(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
if strings.HasPrefix(imgTypeName, "edge-") {
continue
} else {
@ -765,7 +765,7 @@ func TestDistro_DirtyMountpointsNotAllowed(t *testing.T) {
arch, _ := r9distro.GetArch(archName)
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
if strings.HasPrefix(imgTypeName, "edge-") {
continue
} else {
@ -795,7 +795,7 @@ func TestDistro_CustomFileSystemPatternMatching(t *testing.T) {
arch, _ := r9distro.GetArch(archName)
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if imgTypeName == "edge-installer" || imgTypeName == "edge-simplified-installer" || imgTypeName == "edge-raw-image" {
@ -824,7 +824,7 @@ func TestDistro_CustomUsrPartitionNotLargeEnough(t *testing.T) {
for _, imgTypeName := range arch.ListImageTypes() {
imgType, _ := arch.GetImageType(imgTypeName)
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, _, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if imgTypeName == "edge-installer" || imgTypeName == "edge-simplified-installer" || imgTypeName == "edge-raw-image" {

View file

@ -186,20 +186,13 @@ func (t *imageType) PartitionType() string {
return basePartitionTable.Type
}
func (t *imageType) Manifest(customizations *blueprint.Customizations,
func (t *imageType) Manifest(bp *blueprint.Blueprint,
options distro.ImageOptions,
repos []rpmmd.RepoConfig,
packageSpecs map[string][]rpmmd.PackageSpec,
containers []container.Spec,
seed int64) (*manifest.Manifest, []string, error) {
bp := &blueprint.Blueprint{Name: "empty blueprint"}
err := bp.Initialize()
if err != nil {
panic("could not initialize empty blueprint: " + err.Error())
}
bp.Customizations = customizations
// the os pipeline filters repos based on the `osPkgsKey` package set, merge the repos which
// contain a payload package set into the `osPkgsKey`, so those repos are included when
// building the rpm stage in the os pipeline

View file

@ -242,18 +242,20 @@ func (t *TestImageType) Exports() []string {
return distro.ExportsFallback()
}
func (t *TestImageType) Manifest(b *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSpecSets map[string][]rpmmd.PackageSpec, containers []container.Spec, seed int64) (*manifest.Manifest, []string, error) {
mountpoints := b.GetFilesystems()
func (t *TestImageType) Manifest(b *blueprint.Blueprint, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSpecSets map[string][]rpmmd.PackageSpec, containers []container.Spec, seed int64) (*manifest.Manifest, []string, error) {
if b != nil {
mountpoints := b.Customizations.GetFilesystems()
invalidMountpoints := []string{}
for _, m := range mountpoints {
if m.Mountpoint != "/" {
invalidMountpoints = append(invalidMountpoints, m.Mountpoint)
invalidMountpoints := []string{}
for _, m := range mountpoints {
if m.Mountpoint != "/" {
invalidMountpoints = append(invalidMountpoints, m.Mountpoint)
}
}
}
if len(invalidMountpoints) > 0 {
return nil, nil, fmt.Errorf("The following custom mountpoints are not supported %+q", invalidMountpoints)
if len(invalidMountpoints) > 0 {
return nil, nil, fmt.Errorf("The following custom mountpoints are not supported %+q", invalidMountpoints)
}
}
ret := manifest.Manifest{}

View file

@ -52,7 +52,7 @@ func (suite *storeTest) SetupSuite() {
suite.myDistro = test_distro.New()
suite.myArch, _ = suite.myDistro.GetArch(test_distro.TestArchName)
suite.myImageType, _ = suite.myArch.GetImageType(test_distro.TestImageTypeName)
manifest, _, _ := suite.myImageType.Manifest(&suite.myCustomizations, suite.myImageOptions, suite.myRepoConfig, nil, nil, 0)
manifest, _, _ := suite.myImageType.Manifest(&suite.myBP, suite.myImageOptions, suite.myRepoConfig, nil, nil, 0)
suite.myManifest, _ = manifest.Serialize(nil)
suite.mySourceConfig = SourceConfig{
Name: "testSourceConfig",

View file

@ -2533,7 +2533,7 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request
return
}
manifest, warnings, err := imageType.Manifest(bp.Customizations,
manifest, warnings, err := imageType.Manifest(bp,
options,
imageRepos,
packageSets,