main: add progress support via bibs code

This commit add progress reporting similar to what `bib` is doing.
It imports the progress from `bootc-image-builder` for now. There
is an open PR for moving this to images but there are some
concerns about moving it there so for now we just use bib.
This is not too bad because eventually bib and ibcli will merge.
This commit is contained in:
Michael Vogt 2024-12-19 11:54:23 +01:00
parent af0fa97403
commit 1198c73102
4 changed files with 48 additions and 12 deletions

View file

@ -5,8 +5,8 @@ import (
"os"
"path/filepath"
"github.com/osbuild/bootc-image-builder/bib/pkg/progress"
"github.com/osbuild/images/pkg/imagefilter"
"github.com/osbuild/images/pkg/osbuild"
)
type buildOptions struct {
@ -16,7 +16,7 @@ type buildOptions struct {
WriteManifest bool
}
func buildImage(res *imagefilter.Result, osbuildManifest []byte, opts *buildOptions) error {
func buildImage(pbar progress.ProgressBar, res *imagefilter.Result, osbuildManifest []byte, opts *buildOptions) error {
if opts == nil {
opts = &buildOptions{}
}
@ -36,8 +36,5 @@ func buildImage(res *imagefilter.Result, osbuildManifest []byte, opts *buildOpti
}
}
// XXX: support stremaing via images/pkg/osbuild/monitor.go
_, err := osbuild.RunOSBuild(osbuildManifest, opts.StoreDir, opts.OutputDir, res.ImgType.Exports(), nil, nil, false, osStderr)
return err
return progress.RunOSBuild(pbar, osbuildManifest, opts.StoreDir, opts.OutputDir, res.ImgType.Exports(), nil)
}