Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd: add new describe-image command #9

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

mvo5
Copy link
Collaborator

@mvo5 mvo5 commented Dec 12, 2024

[While this should follow https://github.com/osbuild/images/pull/1104, i.e. this output should be used as input in https://github.com/osbuild/images/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
Copy link
Member

supakeen commented Jan 19, 2025

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
Copy link
Collaborator Author

mvo5 commented Jan 28, 2025

While looking at osbuild/bootc-image-builder#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/images#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 thozza and ondrejbudai 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
cmd/image-builder/main.go Outdated Show resolved Hide resolved
cmd/image-builder/describeimg.go Outdated Show resolved Hide resolved
cmd/image-builder/describeimg.go Outdated Show resolved Hide resolved
@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
Copy link
Member

thozza commented Jan 31, 2025

@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?

Copy link
Member

@thozza thozza left a comment

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.

cmd/image-builder/main.go Show resolved Hide resolved
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
Member

@thozza you have requested changes still :)

@mvo5
Copy link
Collaborator Author

mvo5 commented Jan 31, 2025

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

@supakeen
Copy link
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
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants