diff --git a/internal/manifest/os.go b/internal/manifest/os.go index 5837efcfb..89c7b3539 100644 --- a/internal/manifest/os.go +++ b/internal/manifest/os.go @@ -352,7 +352,8 @@ func (p *OS) serialize() osbuild.Pipeline { pipeline.AddStage(osbuild.NewContainersStorageConfStage(containerStoreOpts)) } - skopeo := osbuild.NewSkopeoStage(storagePath, images, nil) + manifests := osbuild.NewFilesInputForManifestLists(p.Containers) + skopeo := osbuild.NewSkopeoStage(storagePath, images, manifests) pipeline.AddStage(skopeo) } diff --git a/internal/osbuild/files_input.go b/internal/osbuild/files_input.go index 64f685bf4..757d3b1cc 100644 --- a/internal/osbuild/files_input.go +++ b/internal/osbuild/files_input.go @@ -3,6 +3,8 @@ package osbuild import ( "encoding/json" "fmt" + + "github.com/osbuild/osbuild-composer/internal/container" ) // SPECIFIC INPUT STRUCTURE @@ -276,3 +278,19 @@ func NewFilesInputSourceObjectRef(entries map[string]FilesInputRefMetadata) File } return &refs } + +// NewFilesInputForManifestLists creates a FilesInput for container manifest +// lists. If there are no list digests in the container specs, it returns nil. +func NewFilesInputForManifestLists(containers []container.Spec) *FilesInput { + refs := make([]string, 0, len(containers)) + for _, c := range containers { + if c.ListDigest != "" { + refs = append(refs, c.ListDigest) + } + } + if len(refs) == 0 { + return nil + } + filesRef := FilesInputSourcePlainRef(refs) + return NewFilesInput(&filesRef) +} diff --git a/test/data/manifests/centos_9-aarch64-edge_commit_with_container-boot.json b/test/data/manifests/centos_9-aarch64-edge_commit_with_container-boot.json index 75ed7d5de..db87c4eff 100644 --- a/test/data/manifests/centos_9-aarch64-edge_commit_with_container-boot.json +++ b/test/data/manifests/centos_9-aarch64-edge_commit_with_container-boot.json @@ -11327,7 +11327,8 @@ "Digest": "sha256:4d76a7480ce1861c95975945633dc9d03807ffb45c64b664ef22e673798d414b", "TLSVerify": null, "ImageID": "sha256:d4ee87dab8193afad523b1042b9d3f5ec887555a704e5aaec2876798ebb585a6", - "LocalName": "registry.gitlab.com/redhat/services/products/image-builder/ci/osbuild-composer/fedora-minimal" + "LocalName": "registry.gitlab.com/redhat/services/products/image-builder/ci/osbuild-composer/fedora-minimal", + "ListDigest": "" } ], "no-image-info": true diff --git a/test/data/manifests/centos_9-x86_64-edge_commit_with_container-boot.json b/test/data/manifests/centos_9-x86_64-edge_commit_with_container-boot.json index ca818de26..acb5b01d7 100644 --- a/test/data/manifests/centos_9-x86_64-edge_commit_with_container-boot.json +++ b/test/data/manifests/centos_9-x86_64-edge_commit_with_container-boot.json @@ -11827,7 +11827,8 @@ "Digest": "sha256:4d76a7480ce1861c95975945633dc9d03807ffb45c64b664ef22e673798d414b", "TLSVerify": null, "ImageID": "sha256:d4ee87dab8193afad523b1042b9d3f5ec887555a704e5aaec2876798ebb585a6", - "LocalName": "registry.gitlab.com/redhat/services/products/image-builder/ci/osbuild-composer/fedora-minimal" + "LocalName": "registry.gitlab.com/redhat/services/products/image-builder/ci/osbuild-composer/fedora-minimal", + "ListDigest": "" } ], "no-image-info": true