diff options
author | Miloslav Trmač <mitr@redhat.com> | 2022-07-30 01:50:45 +0200 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2022-07-30 01:54:22 +0200 |
commit | 68463278e3b22a03fa7a711f4993381747e5e2fc (patch) | |
tree | bcdfa10de06ab1fc65335edc47a12e61630a96ea | |
parent | fed326d8a6f8d4f7dc490099b29d51fc1754789f (diff) | |
download | podman-68463278e3b22a03fa7a711f4993381747e5e2fc.tar.gz podman-68463278e3b22a03fa7a711f4993381747e5e2fc.tar.bz2 podman-68463278e3b22a03fa7a711f4993381747e5e2fc.zip |
Use httpasswd from the surrouding OS instead of the registry image
htpasswd is no longer included in docker.io/library/distribution
after 2.7.0, per https://github.com/docker/distribution-library-image/issues/107 ,
and we want to upgrade to a recent version.
At least system tests currently execute htpasswd from the OS,
so it seems that it is likely to be available.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-rwxr-xr-x | hack/podman-registry | 6 | ||||
-rw-r--r-- | test/e2e/login_logout_test.go | 10 | ||||
-rw-r--r-- | test/e2e/push_test.go | 10 |
3 files changed, 12 insertions, 14 deletions
diff --git a/hack/podman-registry b/hack/podman-registry index f6a266883..84faafb48 100755 --- a/hack/podman-registry +++ b/hack/podman-registry @@ -197,13 +197,11 @@ function do_start() { # 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} \ + htpasswd -Bbn ${PODMAN_REGISTRY_USER} ${PODMAN_REGISTRY_PASS} \ > $AUTHDIR/htpasswd if [ $? -ne 0 ]; then rm -rf ${PODMAN_REGISTRY_WORKDIR} - die "Command failed: podman run [htpasswd]" + die "Command failed: htpasswd" fi # In case someone needs to debug diff --git a/test/e2e/login_logout_test.go b/test/e2e/login_logout_test.go index 3ae130c6d..efefbb113 100644 --- a/test/e2e/login_logout_test.go +++ b/test/e2e/login_logout_test.go @@ -52,15 +52,15 @@ var _ = Describe("Podman login and logout", func() { } } - session := podmanTest.Podman([]string{"run", "--entrypoint", "htpasswd", "registry:2.6", "-Bbn", "podmantest", "test"}) - session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + htpasswd := SystemExec("htpasswd", []string{"-Bbn", "podmantest", "test"}) + htpasswd.WaitWithDefaultTimeout() + Expect(htpasswd).Should(Exit(0)) f, err := os.Create(filepath.Join(authPath, "htpasswd")) Expect(err).ToNot(HaveOccurred()) defer f.Close() - _, err = f.WriteString(session.OutputToString()) + _, err = f.WriteString(htpasswd.OutputToString()) Expect(err).ToNot(HaveOccurred()) err = f.Sync() Expect(err).ToNot(HaveOccurred()) @@ -80,7 +80,7 @@ var _ = Describe("Podman login and logout", func() { setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), filepath.Join(certDirPath, "ca.crt")}) setup.WaitWithDefaultTimeout() - session = podmanTest.Podman([]string{"run", "-d", "-p", strings.Join([]string{strconv.Itoa(port), strconv.Itoa(port)}, ":"), + session := podmanTest.Podman([]string{"run", "-d", "-p", strings.Join([]string{strconv.Itoa(port), strconv.Itoa(port)}, ":"), "-e", strings.Join([]string{"REGISTRY_HTTP_ADDR=0.0.0.0", strconv.Itoa(port)}, ":"), "--name", "registry", "-v", strings.Join([]string{authPath, "/auth:Z"}, ":"), "-e", "REGISTRY_AUTH=htpasswd", "-e", "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm", "-e", "REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd", diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go index f2a103f6b..0faa040f4 100644 --- a/test/e2e/push_test.go +++ b/test/e2e/push_test.go @@ -167,20 +167,20 @@ var _ = Describe("Podman push", func() { } lock := GetPortLock("5000") defer lock.Unlock() - session := podmanTest.Podman([]string{"run", "--entrypoint", "htpasswd", REGISTRY_IMAGE, "-Bbn", "podmantest", "test"}) - session.WaitWithDefaultTimeout() - Expect(session).Should(Exit(0)) + htpasswd := SystemExec("htpasswd", []string{"-Bbn", "podmantest", "test"}) + htpasswd.WaitWithDefaultTimeout() + Expect(htpasswd).Should(Exit(0)) f, err := os.Create(filepath.Join(authPath, "htpasswd")) Expect(err).ToNot(HaveOccurred()) defer f.Close() - _, err = f.WriteString(session.OutputToString()) + _, err = f.WriteString(htpasswd.OutputToString()) Expect(err).ToNot(HaveOccurred()) err = f.Sync() Expect(err).ToNot(HaveOccurred()) - session = podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry", "-v", + session := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry", "-v", strings.Join([]string{authPath, "/auth"}, ":"), "-e", "REGISTRY_AUTH=htpasswd", "-e", "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm", "-e", "REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd", "-v", strings.Join([]string{certPath, "/certs"}, ":"), "-e", "REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt", |