build: introduce buildOptions
This commit is contained in:
parent
94afe7b150
commit
c4357b3bfa
2 changed files with 18 additions and 5 deletions
|
|
@ -5,15 +5,24 @@ import (
|
|||
"github.com/osbuild/images/pkg/osbuild"
|
||||
)
|
||||
|
||||
func buildImage(res *imagefilter.Result, osbuildManifest []byte, osbuildStoreDir, outputDir string) error {
|
||||
type buildOptions struct {
|
||||
OutputDir string
|
||||
StoreDir string
|
||||
}
|
||||
|
||||
func buildImage(res *imagefilter.Result, osbuildManifest []byte, opts *buildOptions) error {
|
||||
if opts == nil {
|
||||
opts = &buildOptions{}
|
||||
}
|
||||
|
||||
// XXX: support output filename via commandline (c.f.
|
||||
// https://github.com/osbuild/images/pull/1039)
|
||||
if outputDir == "" {
|
||||
outputDir = outputDirFor(res)
|
||||
if opts.OutputDir == "" {
|
||||
opts.OutputDir = outputDirFor(res)
|
||||
}
|
||||
|
||||
// XXX: support stremaing via images/pkg/osbuild/monitor.go
|
||||
_, err := osbuild.RunOSBuild(osbuildManifest, osbuildStoreDir, outputDir, res.ImgType.Exports(), nil, nil, false, osStderr)
|
||||
_, err := osbuild.RunOSBuild(osbuildManifest, opts.StoreDir, opts.OutputDir, res.ImgType.Exports(), nil, nil, false, osStderr)
|
||||
return err
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,7 +171,11 @@ func cmdBuild(cmd *cobra.Command, args []string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
return buildImage(res, mf.Bytes(), storeDir, outputDir)
|
||||
buildOpts := &buildOptions{
|
||||
OutputDir: outputDir,
|
||||
StoreDir: storeDir,
|
||||
}
|
||||
return buildImage(res, mf.Bytes(), buildOpts)
|
||||
}
|
||||
|
||||
func run() error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue