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

DRAFT: List logically bound images #871

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

omertuc
Copy link
Contributor

@omertuc omertuc commented Nov 5, 2024

For now this is just the implementation, but it does not contain the important bug fix for #846 which is to allow this command to run inside a container and not just on a bootc booted host

Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

This looks sane to me to start!

I suspect though to really meet the goal we need to think about machine-readable output, which raises its own set of questions.

Also should be straightforward to change test-logically-bound-install.nu to cover this right?

@omertuc
Copy link
Contributor Author

omertuc commented Nov 5, 2024

I suspect though to really meet the goal we need to think about machine-readable output, which raises its own set of questions.

I've played around with formats, none of it is final so feel free to suggest changes:

[omer@hal9000 ~]$ sudo bootc image list
 IMAGE TYPE   IMAGE
 host         docker://quay.io/otuchfel/bootc:listss
 logical      quay.io/curl/curl-base:latest
[omer@hal9000 ~]$ sudo bootc image list --help
List fetched images stored in the bootc storage.

Note that these are distinct from images stored via e.g. `podman`.

Usage: bootc image list [OPTIONS]

Options:
      --list-type <LIST_TYPE>
          Type of image to list

          [default: all]

          Possible values:
          - all:     List all images
          - logical: List only logically bound images
          - host:    List only host images

      --list-format <LIST_FORMAT>
          [default: table]

          Possible values:
          - table: Human readable table format
          - json:  JSON format
          - csv:   CSV format

  -h, --help
          Print help (see a summary with '-h')
[omer@hal9000 ~]$ sudo bootc image list --list-format json
[
  {
    "image_type": "Host",
    "image": "docker://quay.io/otuchfel/bootc:listss"
  },
  {
    "image_type": "Logical",
    "image": "quay.io/curl/curl-base:latest"
  }
]
[omer@hal9000 ~]$ sudo bootc image list --list-format csv
image_type,image
Host,docker://quay.io/otuchfel/bootc:listss
Logical,quay.io/curl/curl-base:latest
[omer@hal9000 ~]$ sudo bootc image list --list-format json --list-type logical
[
  {
    "image_type": "Logical",
    "image": "quay.io/curl/curl-base:latest"
  }
]
[omer@hal9000 ~]$ sudo bootc image list --list-format json --list-type logical | jq '.[].image' -r
quay.io/curl/curl-base:latest

@omertuc
Copy link
Contributor Author

omertuc commented Nov 6, 2024

Also should be straightforward to change test-logically-bound-install.nu to cover this right?

Seems so, I'm trying to get at-least one successful run of the tmt tests on a clean main branch, then I'll see how I can extend the .nu script

@cgwalters
Copy link
Collaborator

I don't see the need to have both csv and json, let's pick json.

This overlaps a bit with #522 in that in theory we could expose this via varlink too? But eh, json seems like a sane baseline.

@omertuc
Copy link
Contributor Author

omertuc commented Nov 7, 2024

I don't see the need to have both csv and json, let's pick json.

Removed CSV (it was trivial to add and to remove so no harm done), it was mostly just an example of how we can add formats easily anyway

@omertuc
Copy link
Contributor Author

omertuc commented Nov 7, 2024

Seems so, I'm trying to get at-least one successful run of the tmt tests on a clean main branch, then I'll see how I can extend the .nu script

Extending a bootc image with the following commands seems to be enough to prepare it , once booted on a VM, for cloning the bootc repo and running make test-tmt successfully:

FROM localhost/bootc

RUN dnf install -y --setopt=install_weak_deps=False cargo git genisoimage libvirt python-pip qemu-kvm rsync && \
    dnf clean all && \
    rm -rf /var/cache/dnf /var/log/dnf* /var/log/yum.*

RUN python3 -m pip install testcloud tmt && \
    rm -rf ~/.cache/pip

RUN systemctl enable virtqemud.socket

Is anything like this documented anywhere? Am I even doing it right or am I missing some obvious simpler way?

@cgwalters
Copy link
Collaborator

Is anything like this documented anywhere? Am I even doing it right or am I missing some obvious simpler way?

I run most things from a toolbox container personally where I have this stuff already installed. What you're doing there is "recursive" which is cool, but I am unsure I would have that be a primary target.

Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

A few nits but looking sane to me!

lib/Cargo.toml Outdated Show resolved Hide resolved
lib/src/image.rs Outdated Show resolved Hide resolved
lib/src/image.rs Outdated Show resolved Hide resolved
lib/src/image.rs Outdated Show resolved Hide resolved
lib/src/image.rs Outdated Show resolved Hide resolved
@omertuc omertuc force-pushed the imagelist branch 3 times, most recently from 89e2978 to b2bb598 Compare November 7, 2024 19:45
For now this is just the implementation, but it does not contain the
important bug fix for containers#846
which is to allow this command to run inside a container and not just on
a bootc booted host

Signed-off-by: Omer Tuchfeld <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants