buildah test helper: run registry:2.6, not :2

The docker.io/registry:2 image broke suddenly and with no warning:

https://github.com/docker/distribution-library-image/issues/106

Symptom: running 'htpasswd' from that container no longer works,
even though it's been documented for years (at docker.com) and
as of this writing still remains documented.

One solution is to run htpasswd locally (requires installing the
httpd-tools package) or using any crypt library to hash. Not
hard, but tedious, and it doesn't address the issue of the
docker registry:2 image being a moving target.

I choose to force the use of the :2.6 tag, in hopes that that
image will remain unmodified. Refactored to use FQIN instead
of shortname, and to define it in only one place.

Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
Ed Santiago 2020-06-24 13:11:01 -06:00
parent 382e5e6121
commit d3311a0623

View File

@ -19,6 +19,8 @@ export IMGTYPE_BINARY=/usr/bin/buildah-imgtype
# Start a registry
pre_bats_setup() {
REGISTRY_FQIN=docker.io/library/registry:2.6
AUTHDIR=/tmp/buildah-tests-auth.$$
mkdir -p $AUTHDIR
@ -31,7 +33,7 @@ pre_bats_setup() {
fi
if [ ! -e $AUTHDIR/htpasswd ]; then
podman run --rm --entrypoint htpasswd registry:2 \
podman run --rm --entrypoint htpasswd $REGISTRY_FQIN \
-Bbn testuser testpassword > $AUTHDIR/htpasswd
fi
@ -44,7 +46,7 @@ pre_bats_setup() {
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/auth/domain.crt \
-e REGISTRY_HTTP_TLS_KEY=/auth/domain.key \
registry:2
$REGISTRY_FQIN
}
post_bats_teardown() {