-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solves the second part of #846 The (hidden) image list command now has a `--type` flag to allow users to list only logical images, only host images, or all images. Also the command has been adjusted so that it can run even when not booted off of a bootc system. In that case, it will only list logical images. If a user tries to list host images without a booted system, an error will be thrown. The command also has a `--format` flag to allow users to choose between a human-readable table format and a JSON format. Signed-off-by: Omer Tuchfeld <[email protected]>
- Loading branch information
Showing
5 changed files
with
263 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,41 @@ | ||
use std assert | ||
use tap.nu | ||
|
||
let images = podman --storage-opt=additionalimagestore=/usr/lib/bootc/storage images --format {{.Repository}} | from csv --noheaders | ||
print "IMAGES:" | ||
podman --storage-opt=additionalimagestore=/usr/lib/bootc/storage images # for debugging | ||
assert ($images | any {|item| $item.column1 == "quay.io/curl/curl"}) | ||
assert ($images | any {|item| $item.column1 == "quay.io/curl/curl-base"}) | ||
assert ($images | any {|item| $item.column1 == "registry.access.redhat.com/ubi9/podman"}) # this image is signed | ||
# This list reflects the LBIs specified in bootc/tests/containerfiles/lbi/usr/share/containers/systemd | ||
let expected_images = [ | ||
"quay.io/curl/curl:latest", | ||
"quay.io/curl/curl-base:latest", | ||
"registry.access.redhat.com/ubi9/podman:latest" # this image is signed | ||
] | ||
|
||
def validate_images [images: table] { | ||
print $"Validating images ($images)" | ||
for expected in $expected_images { | ||
assert ($images | any {|item| $item.image == $expected}) | ||
} | ||
} | ||
|
||
# This test checks that bootc actually populated the bootc storage with the LBI images | ||
def test_logically_bound_images_in_storage [] { | ||
# Use podman to list the images in the bootc storage | ||
let images = podman --storage-opt=additionalimagestore=/usr/lib/bootc/storage images --format {{.Repository}}:{{.Tag}} | from csv --noheaders | rename --column { column1: image } | ||
|
||
# Debug print | ||
print "IMAGES:" | ||
podman --storage-opt=additionalimagestore=/usr/lib/bootc/storage images | ||
|
||
validate_images $images | ||
} | ||
|
||
# This test makes sure that bootc itself knows how to list the LBI images in the bootc storage | ||
def test_bootc_image_list [] { | ||
# Use bootc to list the images in the bootc storage | ||
let images = bootc image list --type logical --format json | from json | ||
|
||
validate_images $images | ||
} | ||
|
||
test_logically_bound_images_in_storage | ||
test_bootc_image_list | ||
|
||
tap ok |