mirror of
https://github.com/containers/podman.git
synced 2025-12-08 06:39:05 +08:00
add new libpod/images/$name/resolve endpoint
Podman Desktop [1] is looking into improving the user experience which requires to know the source of an image. Consider the user triggers an image pull and Podman Desktop wants to figure out whether the image name refers to a Red Hat registry, for instance, to prompt installing the RH auth extension. Since the input values of images may be a short name [2], Podman Desktop has no means to figure out the (potential) source of the image. Hence, add a new `/resolve` endpoint to allow external callers to figure out the (potential) fully-qualified image name of a given value. With the new endpoint, Podman Desktop can ask Podman directly to resolve the image name and then make an informed decision whether to prompt the user to perform certain tasks or not. This for sure can also be used for any other registry (e.g., Quay, Docker Hub). [1] https://github.com/containers/podman-desktop/issues/5771 [2] https://www.redhat.com/sysadmin/container-image-short-names Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
@@ -325,4 +325,22 @@ t DELETE images/$iid_test2?noprune=false 200
|
||||
t GET libpod/images/$iid_test1/exists 404
|
||||
t GET libpod/images/$iid_test2/exists 404
|
||||
|
||||
# If the /resolve tests fail, make sure to use ../registries.conf for the
|
||||
# podman-service.
|
||||
|
||||
# With an alias, we only get one item back.
|
||||
t GET libpod/images/podman-desktop-test123:this/resolve 200 \
|
||||
.Names[0]="florent.fr/will/like:this"
|
||||
|
||||
# If no alias matches, we will get a candidate for each unqualified-search
|
||||
# registry.
|
||||
t GET libpod/images/no-alias-for-sure/resolve 200 \
|
||||
.Names[0]="docker.io/library/no-alias-for-sure:latest" \
|
||||
.Names[1]="quay.io/no-alias-for-sure:latest" \
|
||||
.Names[2]="registry.fedoraproject.org/no-alias-for-sure:latest"
|
||||
|
||||
# Test invalid input.
|
||||
t GET libpod/images/noCAPITALcharAllowed/resolve 400 \
|
||||
.cause="repository name must be lowercase"
|
||||
|
||||
# vim: filetype=sh
|
||||
|
||||
@@ -448,7 +448,8 @@ function start_service() {
|
||||
$PODMAN_BIN unshare true
|
||||
fi
|
||||
|
||||
$PODMAN_BIN \
|
||||
CONTAINERS_REGISTRIES_CONF=$TESTS_DIR/../registries.conf \
|
||||
$PODMAN_BIN \
|
||||
--root $WORKDIR/server_root --syslog=true \
|
||||
system service \
|
||||
--time 0 \
|
||||
|
||||
@@ -21,3 +21,7 @@ location="quay.io/libpod"
|
||||
[[registry]]
|
||||
location="localhost:5000"
|
||||
insecure=true
|
||||
|
||||
# Alias used in tests.
|
||||
[aliases]
|
||||
"podman-desktop-test123"="florent.fr/will/like"
|
||||
|
||||
Reference in New Issue
Block a user