Skip to content

Commit

Permalink
buildah test helper: run registry:2.6, not :2
Browse files Browse the repository at this point in the history
The docker.io/registry:2 image broke suddenly and with no warning:

distribution/distribution-library-image#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 <[email protected]>
  • Loading branch information
edsantiago committed Jun 24, 2020
1 parent 382e5e6 commit d3311a0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/test_buildah.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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() {
Expand Down

0 comments on commit d3311a0

Please sign in to comment.