osbuild: support generating container sources
Modify the existing `GenSources` helper to also support generating `org.osbuild.skopeo` source for fetching container images.
This commit is contained in:
parent
7f3f016ed1
commit
49b37d672b
5 changed files with 15 additions and 5 deletions
|
|
@ -423,7 +423,7 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations,
|
|||
osbuild.Manifest{
|
||||
Version: "2",
|
||||
Pipelines: pipelines,
|
||||
Sources: osbuild.GenSources(allPackageSpecs, nil, nil),
|
||||
Sources: osbuild.GenSources(allPackageSpecs, nil, nil, containers),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -554,7 +554,7 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations,
|
|||
osbuild.Manifest{
|
||||
Version: "2",
|
||||
Pipelines: pipelines,
|
||||
Sources: osbuild.GenSources(allPackageSpecs, commits, inlineData),
|
||||
Sources: osbuild.GenSources(allPackageSpecs, commits, inlineData, containers),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@ func (t *imageType) Manifest(customizations *blueprint.Customizations,
|
|||
osbuild.Manifest{
|
||||
Version: "2",
|
||||
Pipelines: pipelines,
|
||||
Sources: osbuild.GenSources(allPackageSpecs, commits, inlineData),
|
||||
Sources: osbuild.GenSources(allPackageSpecs, commits, inlineData, containers),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ func (m Manifest) Serialize(packageSets map[string][]rpmmd.PackageSpec) (distro.
|
|||
osbuild.Manifest{
|
||||
Version: "2",
|
||||
Pipelines: pipelines,
|
||||
Sources: osbuild.GenSources(packages, commits, inline),
|
||||
Sources: osbuild.GenSources(packages, commits, inline, nil),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/container"
|
||||
"github.com/osbuild/osbuild-composer/internal/ostree"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
|
@ -53,7 +54,7 @@ func (sources *Sources) UnmarshalJSON(data []byte) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func GenSources(packages []rpmmd.PackageSpec, ostreeCommits []ostree.CommitSource, inlineData []string) Sources {
|
||||
func GenSources(packages []rpmmd.PackageSpec, ostreeCommits []ostree.CommitSource, inlineData []string, containers []container.Spec) Sources {
|
||||
sources := Sources{}
|
||||
curl := &CurlSource{
|
||||
Items: make(map[string]CurlSourceItem),
|
||||
|
|
@ -94,5 +95,14 @@ func GenSources(packages []rpmmd.PackageSpec, ostreeCommits []ostree.CommitSourc
|
|||
sources["org.osbuild.inline"] = ils
|
||||
}
|
||||
|
||||
skopeo := NewSkopeoSource()
|
||||
for _, c := range containers {
|
||||
skopeo.AddItem(c.Source, c.Digest, c.ImageID, c.TLSVerify)
|
||||
}
|
||||
|
||||
if len(skopeo.Items) > 0 {
|
||||
sources["org.osbuild.skopeo"] = skopeo
|
||||
}
|
||||
|
||||
return sources
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue