osbuild: create skopeo-index source in GenSources()

When generating sources in GenSources(), add a skopeo-index source
reference for each list-digest found in the container specs.
This commit is contained in:
Achilleas Koutsou 2023-03-17 15:25:48 +01:00
parent e5aaf3e514
commit 753bcaed78

View file

@ -102,13 +102,22 @@ func GenSources(packages []rpmmd.PackageSpec, ostreeCommits []ostree.CommitSpec,
}
skopeo := NewSkopeoSource()
skopeoIndex := NewSkopeoIndexSource()
for _, c := range containers {
skopeo.AddItem(c.Source, c.Digest, c.ImageID, c.TLSVerify)
// if we have a list digest, add a skopeo-index source as well
if c.ListDigest != "" {
skopeoIndex.AddItem(c.Source, c.ListDigest, c.TLSVerify)
}
}
if len(skopeo.Items) > 0 {
sources["org.osbuild.skopeo"] = skopeo
}
if len(skopeoIndex.Items) > 0 {
sources["org.osbuild.skopeo-index"] = skopeoIndex
}
return sources
}