Skip to content
This repository was archived by the owner on Sep 1, 2026. It is now read-only.

cmd: add new describe-image command - #9

Merged
achilleas-k merged 1 commit into
osbuild:mainfrom
mvo5:add-describe-image
Jan 31, 2025
Merged

cmd: add new describe-image command#9
achilleas-k merged 1 commit into
osbuild:mainfrom
mvo5:add-describe-image

Conversation

@mvo5

@mvo5 mvo5 commented Dec 12, 2024

Copy link
Copy Markdown
Contributor

[While this should follow https://github.com/osbuild/image-builder/pull/1104, i.e. this output should be used as input in https://github.com/osbuild/image-builder/pull/1104 we could still make it available as an unstable feature?]

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.

The output looks like this:

$ ./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.

@mvo5 mvo5 mentioned this pull request Dec 13, 2024
@mvo5
mvo5 force-pushed the add-describe-image branch from 998df9d to 1664311 Compare December 19, 2024 09:46
@supakeen

supakeen commented Jan 19, 2025

Copy link
Copy Markdown
Member

Since #6 has landed for a while now we can probably undraft this.

One thing, perhaps we can call it describe? All commands so far work with images.

@mvo5
mvo5 force-pushed the add-describe-image branch from 1664311 to 7625143 Compare January 28, 2025 13:53
@mvo5

mvo5 commented Jan 28, 2025

Copy link
Copy Markdown
Contributor Author

While looking at https://github.com/osbuild/bootc-image-builder/pull/808 I was wondering if we could make it easier to figure out what packages are part of an image and then I did remember this PR. I think the output needs work and it ideally would be an input to osbuild/image-builder#1104 but we are not there yet.

So I was thinking in the meantime we simply could have a warning and mark it as an unstable feature (and deliberately break the yaml from being parseable) and then it would be a useful debug tool already. Wdyt?

@mvo5
mvo5 requested review from ondrejbudai and thozza January 28, 2025 13:57
@mvo5
mvo5 marked this pull request as ready for review January 28, 2025 13:58
@mvo5
mvo5 requested a review from achilleas-k January 29, 2025 09:16
Comment thread cmd/image-builder/main.go
Comment thread cmd/image-builder/main.go Outdated
Comment thread cmd/image-builder/describeimg.go Outdated
Comment thread cmd/image-builder/describeimg.go Outdated
@mvo5
mvo5 force-pushed the add-describe-image branch from 7625143 to 89d7a1e Compare January 29, 2025 15:41
@achilleas-k
achilleas-k self-requested a review January 30, 2025 12:47
@thozza

thozza commented Jan 31, 2025

Copy link
Copy Markdown
Member

@mvo5 I randomly picked one failed RPM build in COPR, and it seems to be failing on unit tests, which is strange because they passed in the GH Action. Could you please take a look?

@thozza thozza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but unit tests are failing in RPM builds in COPR, so blocking the PR, because those are probably not required.

Comment thread cmd/image-builder/main.go
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.
@mvo5
mvo5 force-pushed the add-describe-image branch from 89d7a1e to 56a9a01 Compare January 31, 2025 08:16
@supakeen

Copy link
Copy Markdown
Member

@thozza you have requested changes still :)

@mvo5

mvo5 commented Jan 31, 2025

Copy link
Copy Markdown
Contributor Author

@supakeen its actually @achilleas-k how still has a "change-request" open (the GH ui is a bit confusing)

@supakeen

Copy link
Copy Markdown
Member

Sorry!

@achilleas-k
achilleas-k added this pull request to the merge queue Jan 31, 2025
Merged via the queue into osbuild:main with commit 3c2e8dd Jan 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants