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"
|
"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.
|
// XXX: support output filename via commandline (c.f.
|
||||||
// https://github.com/osbuild/images/pull/1039)
|
// https://github.com/osbuild/images/pull/1039)
|
||||||
if outputDir == "" {
|
if opts.OutputDir == "" {
|
||||||
outputDir = outputDirFor(res)
|
opts.OutputDir = outputDirFor(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: support stremaing via images/pkg/osbuild/monitor.go
|
// 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
|
return err
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,11 @@ func cmdBuild(cmd *cobra.Command, args []string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return buildImage(res, mf.Bytes(), storeDir, outputDir)
|
buildOpts := &buildOptions{
|
||||||
|
OutputDir: outputDir,
|
||||||
|
StoreDir: storeDir,
|
||||||
|
}
|
||||||
|
return buildImage(res, mf.Bytes(), buildOpts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func run() error {
|
func run() error {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue