Commit graph

311 commits

Author SHA1 Message Date
Michael Vogt
ad20533d87 testutil: rename Calls() -> CallArgsList() for clarity
The current MockCmd.Calls() is a bit ambiguous so follow the example
of pytest here and rename to the cleaner CallArgsList() that
captures more closely what the helper is actually doing.
2025-07-17 06:44:29 +00:00
Michael Vogt
bb45b89d84 testutil: remove unnecessary testutil.MockCmd.Restore()
While looking over the code I noticed that the `Restore()` helper
is not needed (and arguably wrong as it does not reset PATH).
We already use `t.TempDir()` and `t.Setenv()` as part of the
command setup so manually cleanup is not neccessary (and is today
even incomplete). So YAGNI and we can remove Restore().
2025-07-17 06:44:29 +00:00
Simon de Vlieger
9717980d3f deps: bump minimum osbuild
images 0.162.0 requires >= 156 for osbuild.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-07-16 08:07:57 +00:00
Simon de Vlieger
ce4eae461f deps: update images to 0.162.0
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-07-16 08:07:57 +00:00
Simon de Vlieger
7b535fdff5 test: smoke test --version
Only verify it returns the correct structure with (some) values in it.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-07-15 08:50:19 +00:00
Simon de Vlieger
3021afb9f7 main: --version includes git commit
Include the commit of the build (if available in the build environment),
also include the version of `images` in the build; if available.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-07-15 08:50:19 +00:00
Ondřej Budai
f52041ab67 packit: enable RHEL 10 builds
COPR now supports them, so let's add them! 🚀
2025-07-14 15:28:03 +00:00
schutzbot
1fadf26d0d Post release version bump
[skip ci]
2025-07-09 08:22:39 +00:00
Tomáš Hozza
57e8468390 Test/main: don't rely on EOL RHEL 8.9 in tests
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-07-09 06:52:47 +00:00
Tomáš Hozza
8d0d7106c5 Always set rhsm.Facts when generating manifests
Make sure that images built by ibcli have correct rhsm.Facts set for
distributions that set it (this is handled by the distro definition, not
by the caller of the manifest generator).

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-07-09 06:52:47 +00:00
Tomáš Hozza
0bc6ce4db3 go.mod: update osbuild/images to v0.156.0
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-07-09 06:52:47 +00:00
Simon de Vlieger
3cabb30ff8 readme: mention mount for container
People often forget to mount, we're a bit clearer about this in
`bootc-image-builder`; let's make it clear here as well.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-06-27 19:50:15 +00:00
Florian Schüller
199f8f3788 doc/10-faq.md: add image types documentation 2025-06-26 13:10:36 +00:00
Florian Schüller
b84e7b8b03 doc/01-usage.md: avoid multiple h1 in one document
Due to https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/Heading_Elements#avoid_using_multiple_h1_elements_on_one_page
metioned in #234 we'll just use a single h1 per document.
2025-06-26 13:06:49 +00:00
Lukas Zapletal
10dde06c33 docs: subscription basic info 2025-06-25 09:02:35 +00:00
schutzbot
b377421793 Post release version bump
[skip ci]
2025-06-25 08:23:15 +00:00
Tomáš Hozza
49c87afb33 cmd/describe: fix describing of '*-simplified-installer' images
The  '*-simplified-installer' images require the installation device
to be specified as a BP customization to serialize their Manifest.
The 'describe' command was not setting those, which resulted in errors
when describing such image types.

Set a dummy installation device BP customization for image types with
their name ending with '-simplified-installer', to enable describing
of such images.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-06-23 18:31:27 +00:00
Tomáš Hozza
44ef682ca1 cmd/describe: fix describing of OSTree images
OSTree images require additional arguments to serialize their Manifest.
The 'describe' command was not setting those, which resulted in errors
when describing such image types.

Set the required minimum OSTree arguments to dummy values to enable
describing of such images.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-06-23 18:31:27 +00:00
Tomáš Hozza
8040fee0d4 cmd/describe: test that all images can be described
Add an unit test to verify that the `describe` command can describe all
image types. I've recently ran into issue when describing ostree-based
and `*-simplified-installer` image types.

Add new dependecy for working with YAML - sigs.k8s.io/yaml.

This is what we will probably converge to, since our currently used YAML
library is unmaintained.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-06-23 18:31:27 +00:00
schutzbot
bb7cab6ac7 Post release version bump
[skip ci]
2025-06-22 07:55:56 +00:00
Simon de Vlieger
24d9b0f7cc chore: bump osbuild in spec
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-06-20 16:36:05 +00:00
Simon de Vlieger
42d41c7d07 chore: bump images
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-06-20 16:36:05 +00:00
Tomáš Hozza
0013049d26 GHA: add the common-stale-action
Add the common-stale-action for marking issues and PRs as stale. This is
consistent with all osbuild group projects.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-06-18 15:41:30 +02:00
schutzbot
cef337ab7a Post release version bump
[skip ci]
2025-06-11 08:22:15 +00:00
Michael Vogt
dd13153b8b upload: try to auto-detect the upload arch from the filename
This is another convenience feature for the `image-builder upload`
command: when we do not know the target architecture try to
guess it from the filename. This is not perfect but it will
help a lot of users and should be fine until the day we go
and inspect the image.
2025-06-07 12:29:18 +00:00
Michael Vogt
03613a3fb3 upload: warn the user if no --arch flag is passed on upload
This mitigates the issue that a `image-builder upload` command
currently does not know the target architecture of the image
it uploads.
2025-06-07 12:29:18 +00:00
Michael Vogt
2c017fc630 upload: default to boot-mode uefi-preferred when unset
When using `image-builder upload --to=aws` we do not know
the bootmode. Ideally we would introspect the image for
the boot mode but that is not trivial right now.

So for now just default to platform.BOOT_HYBRID which
translated to `uefi-preferred` in the AWS API calls
which should offer the widest compatbility and should
fix the issue that aarch64 does not boot currently
when uploaded via ibcli.
2025-06-07 12:29:18 +00:00
Michael Vogt
62bf88cc62 bib: pass the boot-mode to AWS when doing combined build/upload
This commit passes the boot mode to AWS when doing a combined
build/upload. Here we know what boot mode to use and we can
pass it easily.

This also adds a "XXX" to think about how to handle what to
do when uploading a pre-existing image where we do not know
the boot mode.
2025-06-07 12:29:18 +00:00
Michael Vogt
2996bbc0d1 image-builder: fix cross-arch uploading
This commit fixes the cross-arch uploading in the most simple
case by reading the `--arch` when `image-builder build --upload`
is used. Note that this is not a complete fix as it will not
take boot mode into account nor will it (by default) DTRT when
`image-builder upload` is used on a previously build images
for a different architecture.

Thanks to `FrostyX` for reporting the issue.
2025-06-07 12:29:18 +00:00
Simon de Vlieger
f4f8b557a5 packit: rename epel9-next
We've had issues proposing downstream for epel9-next due to branch name
failures. Let's see if this resolves that.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-06-05 07:45:58 +00:00
schutzbot
06930c3af1 Post release version bump
[skip ci]
2025-05-30 14:01:37 +00:00
Simon de Vlieger
26bf19373a test/main: update types used
Image types were renamed [1] in images for the Fedora distribution.
While aliases were left behind for compatibility those are not used
when directly requesting manifests it seems.

Let's rename them to their canonical names.

[1]: 65194a4bf

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-05-28 08:19:05 +00:00
Simon de Vlieger
33f7822c28 test/main: update registrations test
There was previously a bug in the Insights client configuration stage
which omitted a key [1]. A testcase hardcoded this invalid format. Let's
update it to the expected value.

[1]: 389b629ce2

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-05-28 08:19:05 +00:00
Simon de Vlieger
89ce20101b test/main: no more fedora-40
Fedora 40 was removed from `images` as it is EOL, we can no longer use
it in our test cases. Bump to Fedora 42.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-05-28 08:19:05 +00:00
Simon de Vlieger
92095eac06 deps: update
Update dependencies to get the latest images into `image-builder`; this
includes Alma Linux, a Vagrant image type for Fedora, and WSL
improvements for Fedora.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-05-28 08:19:05 +00:00
schutzbot
de4879d4e6 Post release version bump
[skip ci]
2025-05-14 08:21:06 +00:00
Lukas Zapletal
392a04fd12 refactor: use standard logger instead of logrus 2025-05-12 18:21:37 +00:00
schutzbot
48cd004bed Post release version bump
[skip ci]
2025-04-30 08:21:01 +00:00
Michael Vogt
7af1a8d8b3 README.md: add a section about adding "registrations"
This is a small followup for
https://github.com/osbuild/image-builder-cli/pull/201
to include information about how to use the new
`--registrations` option.
2025-04-28 09:51:43 +00:00
Lukas Zapletal
4c9f2b4ba4 manifest: use Sync instead of Close 2025-04-24 06:18:10 +00:00
Michael Vogt
c829e60649 manifest: handle "close()" errors in sbomWriter()
This commit adds error handling for the `f.Close()` errors when
we write the SBOM. Errors on close for RW fds are rare but we
should handle them so we return the result of `f.Close()` now
when returning in sbomWriter(). We still keep the `defer f.Close()`
to ensure we do not leak file descriptors when e.g. `io.Copy()`
fails. In the "happy" case f is closed without an error and
then the defer f.Close() runs and will error with "ErrClosed"
but we can ignore that.

An alternative implementaiton might be:
```golang
func sbomWriter(outputDir, filename string, content io.Reader) (err error) {
	...
	f, err := os.Create(p)
	if err != nil {
		return err
	}
	defer func() { err = errors.Join(err, f.Close()) }()
	...
	return nil
}
```
no super strong opinion here.

Thanks to Flo for finding this issues!
2025-04-23 06:46:39 +00:00
Tomáš Hozza
1a2f4be378 Add unit test for describe-image
Add a unit test for testing that providing only the required command
line arguments produces expected output.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2025-04-17 13:20:55 +00:00
Michael Vogt
aecbe5928a main: add new --registrations options
This new flag allows to add a file with registration data. This
is meant to eventually hold all sort of registrations like
ansible or satelite but initially only contains the redhat
subscription. Currently only JSON is supported.

It looks like:
```json:
{
  "redhat": {
    "subscription": {
      "activation_key": "ak_123",
      "organization": "org_123",
      "server_url": "server_url_123",
      "base_url": "base_url_123",
      "insights": true,
      "rhc": true,
      "proxy": "proxy_123"
    }
  }
}
```

This is not part of the blueprint (today) because its more
ephemeral than the things we usually put into the blueprint.

This allows us to build images that are immediately registered. It
also keeps our options open in the future. If we move to a new
blueprint format where we support multiple blueprints and also
ephemeral data like this the "registrations" flag just becomes an
alias for "--blueprint".
2025-04-17 13:17:24 +00:00
schutzbot
020dbd6f41 Post release version bump
[skip ci]
2025-04-17 06:49:37 +00:00
Simon de Vlieger
81162a0736 deps: bump images and osbuild
Some important PRs have landed there, I'd like to do an extra release to
push these out.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-04-16 19:58:29 +00:00
schutzbot
8bd065dbca Post release version bump
[skip ci]
2025-04-16 08:22:33 +00:00
Michael Vogt
6454da7b7e workflow: add createrepo_c package to test dependencies
This will fix the issue that TestManifestExtraRepo was not
run.
2025-04-10 10:26:01 +00:00
Michael Vogt
e3d23aa5ad test: fix missing conversion of a test blueprint to toml
This commit fixes the issue that a test blueprint was not converted
from json to TOML. This was not caught in CI apparently because
our test container misses createrepo_c.
2025-04-10 10:26:01 +00:00
Florian Schüller
e8e0d9c4e8 doc/00-installation: Add link to package details
There should be a link to the package details, not only
the reference to the main fedora page.
2025-04-09 15:14:41 +00:00
Simon de Vlieger
6f883c1407 doc: mention root perms for build
Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
2025-04-09 08:18:20 +00:00