This commit adds a new `--store` flag to the `image-builder build` command. This is used to specify a osbuild store directory to store the intermediate build tree for faster rebuilding. It is also useful for the container version of `image-builder-cli` to allow mapping the users store into the container.
23 lines
755 B
Go
23 lines
755 B
Go
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, osbuildStoreDir string) error {
|
|
// 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
|
|
|
|
}
|