mirror of
https://github.com/containers/podman.git
synced 2025-05-17 23:26:08 +08:00
podman-registry: many unrelated fixes
1) fix lost credentials. must_pass(), added in #6375, eats the credentials generated via 'podman run --entrypoint htpasswd'. Run that podman instance directly, and add explicit error check. (The error and stdout/stderr handling here has gotten cumbersome. There must be something I'm missing that could make it all simpler.) 2) fix default podman path. When setting $PODMAN, default to the locally built one -- there may not be one in $PATH (e.g. in Ubuntu, see #6366). This in turn requires us to: 3) run registry test in integration, not unit test It looks like unit tests run before podman is built, causing a chicken-egg dilemma. Try to solve that by running the new hack/podman-registry-go test in integration tests, not unit tests. Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -14,7 +14,7 @@ PODMAN_REGISTRY_PASS=
|
||||
PODMAN_REGISTRY_PORT=
|
||||
|
||||
# Podman binary to run
|
||||
PODMAN=${PODMAN:-$(type -p podman)}
|
||||
PODMAN=${PODMAN:-$(dirname $0)/../bin/podman}
|
||||
|
||||
# END defaults
|
||||
###############################################################################
|
||||
@ -176,11 +176,16 @@ function do_start() {
|
||||
-out ${AUTHDIR}/domain.crt \
|
||||
-subj "/C=US/ST=Foo/L=Bar/O=Red Hat, Inc./CN=localhost"
|
||||
|
||||
# Store credentials where container will see them
|
||||
must_pass podman run --rm \
|
||||
--entrypoint htpasswd ${PODMAN_REGISTRY_IMAGE} \
|
||||
-Bbn ${PODMAN_REGISTRY_USER} ${PODMAN_REGISTRY_PASS} \
|
||||
> $AUTHDIR/htpasswd
|
||||
# Store credentials where container will see them. We can't run
|
||||
# this one via must_pass because we need its stdout.
|
||||
podman run --rm \
|
||||
--entrypoint htpasswd ${PODMAN_REGISTRY_IMAGE} \
|
||||
-Bbn ${PODMAN_REGISTRY_USER} ${PODMAN_REGISTRY_PASS} \
|
||||
> $AUTHDIR/htpasswd
|
||||
if [ $? -ne 0 ]; then
|
||||
rm -rf ${PODMAN_REGISTRY_WORKDIR}
|
||||
die "Command failed: podman run [htpasswd]"
|
||||
fi
|
||||
|
||||
# In case someone needs to debug
|
||||
echo "${PODMAN_REGISTRY_USER}:${PODMAN_REGISTRY_PASS}" \
|
||||
|
Reference in New Issue
Block a user