Commit graph

159 commits

Author SHA1 Message Date
Michael Vogt
1a14f5bae3 go.mod: update images to v0.116.0 2025-02-10 20:40:53 +01:00
Michael Vogt
0a3c642772 go.mod: update to get the latest progress fixes from bib
This commit updates the `progress` package to get the latest
fixes, most notably
https://github.com/osbuild/bootc-image-builder/pull/820
2025-02-10 11:46:55 +01:00
Simon de Vlieger
036de52a39
describeimg: typo in describe output
`os_vesion` -> `os_version`

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-02-06 20:00:49 +01:00
Michael Vogt
7c6db68c98 main: add -v,--verbose switch that enables verbose build logging
This commit adds a new `-v,--verbose` switch that enables verbose
build logging.

Closes: https://github.com/osbuild/image-builder-cli/issues/112
2025-02-05 09:36:38 +00:00
schutzbot
8b09755cab Post release version bump
[skip ci]
2025-02-05 08:17:38 +00:00
Michael Vogt
19ef77337a main: reset the terminal properly on SIGINT,SIGTERM
This commit fixes the issue that on `CTRL-C` (SIGINT) the progress
is not properly cleared. It also catches SIGTERM for good measure.

No test right now as this is hard to test automatically :/

Closes: https://github.com/osbuild/image-builder-cli/issues/123
2025-02-04 13:11:11 +00:00
Michael Vogt
24dc23ac3b main: fix auto-detected distro that is non-visible, tweak order
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
2025-02-04 12:21:13 +00:00
schutzbot
fdab539045 Post release version bump
[skip ci]
2025-02-03 13:23:26 +00:00
Simon de Vlieger
379c97456b ci/packit: set downstream name
Since our upstream repository name differs from the downstream name we
should set the `downstream_package_name` [1] config option.

[1]: https://packit.dev/docs/configuration#downstream_package_name

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-02-03 11:28:26 +00:00
Simon de Vlieger
f9ff8ffbf1 specfile: build requires libxcrypt-compat
We received a commit downstream by Björn Esser. After asking around for
the reasoning behind the commit it seems that we're likely assuming that
this package is available in the buildroot.

Let's depend on it explicitly instead of assuming it is there.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-02-03 11:27:37 +00:00
schutzbot
44d6622ba9 Post release version bump
[skip ci]
2025-02-03 08:38:08 +00:00
Simon de Vlieger
29e7814796 ci/packit: enable fedora PRs
Enable automatic builds and PR creation in Fedora since `image-builder`
has landed there.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-02-03 08:26:21 +00:00
Michael Vogt
3c2e8dd9af cmd: add new describe-image command
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.
2025-01-31 10:57:50 +00:00
Simon de Vlieger
2455b9d586 doc: initial documentation
Supply initial documentation for `image-builder`. This documentation
will be imported into the osbuild [1] website.

[1]: https://osbuild.org/

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-31 08:06:22 +00:00
Michael Vogt
c590c38d4f main: silence all logrus logging for now
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.
2025-01-30 17:30:31 +00:00
Michael Vogt
0f0815d268 main: tweak the help of manifest and build
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.
2025-01-29 20:50:47 +00:00
Michael Vogt
c72ed92a2f Containerfile: build without cgo to avoid arm64 crashing
This commit changes the build to not build with CGO. There is really
no need to build with CGO, we only need it for the `crypt()` version
in the images library. However since with the merge of
https://github.com/osbuild/images/pull/1114
that is no longer an issue.
2025-01-29 20:50:10 +00:00
Michael Vogt
f46ca14f85 image-builder: update TestBuildIntegrationErrors tests
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.
2025-01-29 15:21:33 +00:00
Michael Vogt
e41cf0e429 testutil: add new CaptureStdio helper
This commit adds a new testutil.CaptureStdio helper so that we
can test external go modules that use os.Std{out,err} but now
allow mocking or overwriting.
2025-01-29 15:21:33 +00:00
Michael Vogt
c78ea5f2b2 test: add test that checks that --progress works correctly
This commit checks that the `--progress` argument generates the
expected output, i.e. with `term` we will not get any osbuild
output and the spinner. And with `verbose` we will not get a
spinner and the osbuild output.
2025-01-29 15:21:33 +00:00
Michael Vogt
9a0f2ee7d7 test: copied build_fake_container_fixture() from bib
This is a very sad commit, it copies the code to make a fake
container with a faked osbuild.

The bright side is that the plan is to rewrite these helpers
in go and then we can just have a shared testutil module that
can be imported from both bib/ibcli.

And/or the two repos will merge and its just a (simple) test
helper. But I do not feel good (at all) about this.
2025-01-29 15:21:33 +00:00
Michael Vogt
1198c73102 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.
2025-01-29 15:21:33 +00:00
Simon de Vlieger
af0fa97403 manifest: slightly clean up directory creation
Co-authored-by: Michael Vogt <michael.vogt@gmail.com>
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-29 11:56:14 +00:00
Simon de Vlieger
34de7d7ce5 build: directory creation
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>
2025-01-29 11:56:14 +00:00
Simon de Vlieger
a5f5b48293 test: write manifest in build
Having this test triggers the conditions for #94. This test case is
failing and the next commit fixes the bug.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-29 11:56:14 +00:00
Simon de Vlieger
c7652c0251 specfile: changelog
Have a proper changelog entry.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-28 11:11:49 +00:00
Simon de Vlieger
a31440a39d specfile: absolute Source0
Use a Source0 that works directly instead of having to go through
automation to build.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-28 11:11:49 +00:00
Simon de Vlieger
128509da2e specfile: prune unused buildrequires
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-28 11:11:49 +00:00
Simon de Vlieger
e7b6a0eee1 specfile: drop excludearch armv7hl
This architecture was retired in Fedora 37.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-28 11:11:49 +00:00
Simon de Vlieger
de9ec9d912 specfile: remove unused conditions
These are leftovers and not currently used in the specfile.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-28 11:11:49 +00:00
Michael Vogt
279fa163d6 README: add FAQ about relation between bib and ibcli
This commit adds a small FAQ entry to explain the relation between
`bib` and `ibcli`.

Thanks to Jonathan Lebon for the suggesiton.

Closes: https://github.com/osbuild/image-builder-cli/issues/89
2025-01-28 11:03:16 +00:00
Michael Vogt
98e4bebcfa image-builder: drop internal manifestgen in favor of images
This commit drops the internal `manifestgen` package in favor
of using the version in `images` now that
https://github.com/osbuild/images/pull/1153 is merged.
2025-01-27 10:14:53 +00:00
dependabot[bot]
cf890c7297 build(deps): bump github.com/osbuild/images in the go-deps group
Bumps the go-deps group with 1 update: [github.com/osbuild/images](https://github.com/osbuild/images).


Updates `github.com/osbuild/images` from 0.111.1-0.20250124075826-58bc61d3c5d9 to 0.112.0
- [Release notes](https://github.com/osbuild/images/releases)
- [Commits](https://github.com/osbuild/images/commits/v0.112.0)

---
updated-dependencies:
- dependency-name: github.com/osbuild/images
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-27 08:51:34 +00:00
Ondřej Budai
5d1be8bbb1 cmd/image-builder: fix typos in cobra descs 2025-01-27 08:46:32 +00:00
Simon de Vlieger
cfe8f7c289 test: switch to platform.machine
For some reason on a bunch of my systems `platform.processor()` always
returns an empty string. `platform.machine()` consistently works on
those systems.

This closes #95.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-27 08:32:33 +00:00
Michael Vogt
222d42dc1c test: consolidate the build argument tests into a single table
This commit puts the build argument tests into a single table to
cosolidate them a bit.
2025-01-25 11:08:01 +00:00
Michael Vogt
a9bd51338e github: run tests inside a fedora container
Running the tests inside fedora means we get much more meaningful
results as we will have all the required packaes and there will
be no need to skip tests.
2025-01-25 11:05:05 +00:00
Florian Schüller
b4815631a3 cmd/image-builder/main: fix typo in --filter help 2025-01-24 14:05:17 +00:00
Florian Schüller
3f881601fc cmd/image-builder/main: improve wording of --blueprint help
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.
2025-01-24 14:00:54 +00:00
Simon de Vlieger
c1572905fe deps: update images
Update images to understand the `main` of `osbuild` that we integration
test against.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-24 10:00:07 +00:00
schutzbot
8364c5e745 Post release version bump
[skip ci]
2025-01-22 08:18:19 +00:00
Florian Schüller
f10766506d README: document required dependency
As a dependency of `images` we also need `gpgme-devel` here,
if we compile without `containers_image_openpgp`.
2025-01-21 14:20:18 +00:00
schutzbot
54d9ab47d3 Post release version bump
[skip ci]
2025-01-21 10:45:07 +00:00
Simon de Vlieger
ffb3ca0b76 packit: explicitly enable the GOPROXY
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-21 10:38:20 +00:00
Simon de Vlieger
c009b8ad92 spec: use go-vendor-tools to generate license
Use go-vendor-tools to generate the license identifiers for our vendored
code. This initial commit does not yet apply the rest of go-vendor-tools
abilities to manage the vendoring itself.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-21 10:38:20 +00:00
schutzbot
3b21375460 Post release version bump
[skip ci]
2025-01-20 20:39:17 +00:00
Florian Schüller
878cc5cacf Makefile: Enhance and improve help
Enhance help for undocumented targets and
improve developer usability by leveraging
inline comments, like in the other repos.
2025-01-20 18:22:44 +00:00
Simon de Vlieger
c136684426 README: mention sbom/manifest
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-20 15:42:21 +00:00
Simon de Vlieger
ebba957fad test: add combi test sbom/manifest
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-20 15:42:21 +00:00
Simon de Vlieger
613f56e7d2 image-builder: slight cleanup
Remove all slice operations.

Co-authored-by: Michael Vogt <michael.vogt@gmail.com>
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-01-20 15:42:21 +00:00