This commit fixes the issue that the auto-detect distro is not
visible in the progress message. It also tweaks the order of
the message to show:
```
Building manifest for <distro>-<img-type>
```
to be more conistent.
Closes: https://github.com/osbuild/image-builder-cli/issues/121
This commit adds a new `describe-image` comamnd that contains
the details about the given image type. The output is yaml as
it is both nicely human readable and also machine readable.
Note that this version carries an invalid yaml header on
purpose to avoid people replying on the feature for scripts
before it is stable.
The output looks like this:
```yaml
$ ./image-builder describe-image rhel-9.1 tar
@WARNING - the output format is not stable yet and may change
distro: rhel-9.1
type: tar
arch: x86_64
os_vesion: "9.1"
bootmode: none
partition_type: ""
default_filename: root.tar.xz
packages:
include:
- policycoreutils
- selinux-policy-targeted
- selinux-policy-targeted
exclude:
- rng-tools
```
Thanks to Ondrej Budai for the idea and the example.
This commit silences logrus logging for now by just dicarding
everything from it. The rational is that the underlying libraries
produce a lot of output, e.g. every build currently results in
```console
$ image-builder build qcow2
WARN[0000] Failed to load consumer certs: no consumer key found
...
```
which is confusing to our users. What is worse is that containers
also uses logrus so we can get random warnings without context
from there too. Until we have a way to filter log messages this
seems to be the most practical way.
We can add `--verbose` or `--debug` later to enable these kinds
of messages.
This commit tweaks the help output for the manifest and build
commands to make clear that only the image type is a required
argument but the rest can be overriden via extra flags.
Thanks to Achilleas for noticing.
This commit updates the tests for the error reporting. Since
we are now using the new "progress" module we can no longer
directly mock osStderr. So this now uses the new testutil
helper `CaptureStdio`.
Note also that the behavior of `verbose` and `term` is slightly
different - for backward compatibility in `verbose` mode the
stderr from osbuild is directly connected to the caller stderr.
For term mode this is not done to prevent spurious message from
leaking into the terminal progress and the full error is available
from the actual go error as captured output.
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 now precreates the directory as it's possible that the directory
doesn't exist yet at this point; see #94.
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
When reading `--blueprint string`, I briefly thought it might
also be possible to put a whole blueprint content as string
into image-builder-cli argument.
This wording should avoid misunderstandings.
This commit adds support for `--extra-artifacts=manifest`. If
that is given as part of the build an extra artifacts called
`<img-name>.osbuild-manifest.json` will be created in the
output directory.
Closes: https://github.com/osbuild/image-builder-cli/issues/42
This commit adds a new `--output-dir` option to override the
default output directory for the generated artifacts.
Note that this can also be used together with `manifest` when
extra artifacts (like the sbom) is requested.
This commit adds an option --extra-artifacts that can be
used to generate extra artifacts during the build or manifest
generation. Initially supported is `sbom` (but `manifest` is
planned too).
To use it run `--extra-artifacts=sbom` and it will generate
files like `centos-9-qcow2-x86_64.image-os.spdx.json` in
the output directory next to the generate runable artifact.
Closes: https://github.com/osbuild/image-builder-cli/issues/46
This commit switches the default to librepo. We do not have many
users yet so this is a great place to test the new librepo
functionality. It also is much more stable for fedora/centos
systems that often have flaky mirrors.
This also bumps the minimum required version of osbuild.
This commit adds a new manifestOptions struct that is passed
to generateManifest. to cleanup the signature of generateManifest().
This can then also be used to carry a new e.g. `--rpmmd/--cachedir`
option.
This commit switches to the librepo enabled `images` library via:
```
go mod -replace github.com/osbuild/iamges=github.com/mvo5/images@librepo-sources-osbuild1974
```
which in turn needs osbuild PR#1974.
With that it then adds a new `--use-librepo` switch that will
enable librepo based downloading so that people can play with
the new backend.
Moves the blueprint argument to a named argument; freeing up space to
later be able to pass in multiple image types. This also slightly
simplifies the case where we're building without a blueprint available.
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
This commit adds integration for the ostree options. It is modelled
loosely after weldr-client/composer-cli and the
```
start-ostree --{ref,parent,url}
```
and uses
```
--ostree-{ref,parent,url}
```
A simple smoke test is provided that uses fedora-iot. Ideas welcome
for an easier way :)
With the new build-in repos this test is no longer relevant. We
need to look into a different way to test overrides but just
providing an empty datadir will no longer work so drop that.
This commit switches the default repositories to use the build-in
ones from images PR#1112. It is still possible to override using
`/etc/image-builder` and `/usr/share/image-builder` or `--datadir`.
This is implicitly tested via the container test that no longer
includes the files from osbuild-composer in the container.
This commit follows a suggestion from Ondrej to add a better
default for `--store`: /var/cache/image-builder/store.
This is nice as it will give users automatic caching and makes
the container also nicer.
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.
This commit tweaks the argument handling based on the suggestion
by Achilleas and Ondrej (thanks!). Now it takes
```console
$ image-builder manifest qcow2 ./path/to/blueprint
...
$ image-builder manifest --arch s390x --distro centos-9 qcow2
...
```
If no arch is specified the hostname arch is used. If no distro
is specified in either the blueprint or the commandline it is
auto-detected based on the host.
Note that if the distro from the comandline and the blueprint
diverge an error is raised. We can relax this rule and just
add precedence, e.g. commandline always overrides the blueprint
but ideally we would have a clear use-case here so we start
conservative and can always relax this rule later (the inverse
is much harder).
This means it is no longer copy/paste friendly from `list-images`
by default but instead we can provide a new
`list-images --output=shell` option that outputs in exactly the
format that `image-builder [manifest|build]` need.
This commit adds an integration test for the container resolving
when generating a manifest. This is sadly quite indirect right now
because `manifestgen` needs some more support from `images` and
the `distro_test` code there (that will hopefully come soon(ish)).
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`.
This commit adds a helper to find exactly a single image from a
given disto/type/arch description. This will be used in `manifest`,
`build` and potentially more. It is meant to support copy/paste
from the `image-builder list-images` output, so: "distro:centos-9"
is support just like "centos-9" (same for distro/imgType/arch).
This commit adds a `--datadir` override that allows overriding
the default search paths for e.g. the custom repositories. In
practise only repository overrides are supported because that
is the only data stored there.
This commit adds the new `image-builder` binary. This binary is
meant to build images from the CLI without the need to setup a
daemon. The main use-case is CI/CD and admins running this in
scripts or ad-hoc. The CLI should be pleasant to use.
This first commit adds the `list-images` command which is a thin
wrapper around functionality from the `osbuild/images` library.
It will list all buildable images by default and can be trimmed
down further via `--filter` which supports the filtering from
the `images` library, see https://github.com/osbuild/images/pull/1015
It also supports `--output` which will output the result in the
given format. Currently "text" and "json" are supported.
Note that this will not work on it's own yet, it will need an
installed image-builder to get the repositories. This will need
to get fixed via either:
1. a dependency package for `ibuilder` that carries all the repos
2. a shared repo that contains the repos
3. using go:embed to get them (see images#1038)