cmd: add new build command
This commit adds the `build` command. It takes the same flags as `manifest` and will build the specified image.
This commit is contained in:
parent
ce8dd45821
commit
e5b3ccd6ed
5 changed files with 193 additions and 16 deletions
24
cmd/image-builder/build.go
Normal file
24
cmd/image-builder/build.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/osbuild/images/pkg/imagefilter"
|
||||
"github.com/osbuild/images/pkg/osbuild"
|
||||
)
|
||||
|
||||
func buildImage(res *imagefilter.Result, osbuildManifest []byte) error {
|
||||
osbuildStoreDir := ".store"
|
||||
// XXX: support output dir via commandline
|
||||
// XXX2: support output filename via commandline (c.f.
|
||||
// https://github.com/osbuild/images/pull/1039)
|
||||
outputDir := "."
|
||||
buildName := fmt.Sprintf("%s-%s-%s", res.Distro.Name(), res.ImgType.Name(), res.Arch.Name())
|
||||
jobOutputDir := filepath.Join(outputDir, buildName)
|
||||
|
||||
// XXX: support stremaing via images/pkg/osbuild/monitor.go
|
||||
_, err := osbuild.RunOSBuild(osbuildManifest, osbuildStoreDir, jobOutputDir, res.ImgType.Exports(), nil, nil, false, osStderr)
|
||||
return err
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue