This commit implements the `manifest` command for `image-builder`.
It will generate an osbuild manifest based on the given inputs,
e.g.:
```
$ ./image-builder manifest centos-9 qcow2
{"version":"2","pipelines":[{"name":"build","runner":",...
```
Note that there is an integration test but because of the depsolve
it will be slow. It will be skipped when doing `go test -short`.
27 lines
529 B
Go
27 lines
529 B
Go
package main
|
|
|
|
import (
|
|
"github.com/osbuild/images/pkg/imagefilter"
|
|
)
|
|
|
|
func listImages(dataDir, output string, filterExprs []string) error {
|
|
imageFilter, err := newImageFilterDefault(dataDir)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
filteredResult, err := imageFilter.Filter(filterExprs...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
fmter, err := imagefilter.NewResultsFormatter(imagefilter.OutputFormat(output))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if err := fmter.Output(osStdout, filteredResult); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|