cmd/osbuild-pipeline: resolve blueprint container
Add support for resolving containers via `container.Resolver`.
This commit is contained in:
parent
2007d67fd2
commit
a24cc16bb0
1 changed files with 27 additions and 1 deletions
|
|
@ -9,6 +9,7 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/container"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
||||
"github.com/osbuild/osbuild-composer/internal/dnfjson"
|
||||
|
|
@ -60,6 +61,20 @@ func findDnfJsonBin() string {
|
|||
panic(fmt.Sprintf("could not find 'dnf-json' in any of the known paths: %+v", locations))
|
||||
}
|
||||
|
||||
func resolveContainers(bp blueprint.Blueprint, archName string) ([]container.Spec, error) {
|
||||
if len(bp.Containers) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
resolver := container.NewResolver(archName)
|
||||
|
||||
for _, c := range bp.Containers {
|
||||
resolver.Add(c.Source, c.Name, c.TLSVerify)
|
||||
}
|
||||
|
||||
return resolver.Finish()
|
||||
}
|
||||
|
||||
func main() {
|
||||
var rpmmdArg bool
|
||||
flag.BoolVar(&rpmmdArg, "rpmmd", false, "output rpmmd struct instead of pipeline manifest")
|
||||
|
|
@ -182,11 +197,22 @@ func main() {
|
|||
panic(err)
|
||||
}
|
||||
} else {
|
||||
|
||||
containerSpecs, err := resolveContainers(composeRequest.Blueprint, arch.Name())
|
||||
if err != nil {
|
||||
panic("Could not resolve containers: " + err.Error())
|
||||
}
|
||||
|
||||
if composeRequest.OSTree.Ref == "" {
|
||||
// use default OSTreeRef for image type
|
||||
composeRequest.OSTree.Ref = imageType.OSTreeRef()
|
||||
}
|
||||
|
||||
manifest, err := imageType.Manifest(composeRequest.Blueprint.Customizations,
|
||||
options,
|
||||
repos,
|
||||
depsolvedSets,
|
||||
nil,
|
||||
containerSpecs,
|
||||
seedArg)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue