From cc23fdacffec257f28a040928f379227bad75602 Mon Sep 17 00:00:00 2001 From: Cory Snider Date: Tue, 24 Oct 2023 12:26:38 -0400 Subject: [PATCH] Move registry client internal Our registry client is not currently in a good place to be used as the reference OCI Distribution client implementation. But the registry proxy currently depends on it. Make the registry client internal to the distribution application to remove it from the API surface area (and any implied compatibility promises) of distribution/v3@v3.0.0 without breaking the proxy. Signed-off-by: Cory Snider --- {registry => internal}/client/auth/api_version.go | 0 {registry => internal}/client/auth/challenge/addr.go | 0 .../client/auth/challenge/authchallenge.go | 0 .../client/auth/challenge/authchallenge_test.go | 0 {registry => internal}/client/auth/session.go | 6 +++--- {registry => internal}/client/auth/session_test.go | 4 ++-- {registry => internal}/client/blob_writer.go | 0 {registry => internal}/client/blob_writer_test.go | 0 {registry => internal}/client/errors.go | 2 +- {registry => internal}/client/errors_test.go | 0 {registry => internal}/client/repository.go | 2 +- {registry => internal}/client/repository_test.go | 0 {registry => internal}/client/transport/http_reader.go | 0 .../client/transport/http_reader_test.go | 0 {registry => internal}/client/transport/transport.go | 0 registry/proxy/proxyauth.go | 4 ++-- registry/proxy/proxymanifeststore_test.go | 4 ++-- registry/proxy/proxyregistry.go | 8 ++++---- 18 files changed, 15 insertions(+), 15 deletions(-) rename {registry => internal}/client/auth/api_version.go (100%) rename {registry => internal}/client/auth/challenge/addr.go (100%) rename {registry => internal}/client/auth/challenge/authchallenge.go (100%) rename {registry => internal}/client/auth/challenge/authchallenge_test.go (100%) rename {registry => internal}/client/auth/session.go (98%) rename {registry => internal}/client/auth/session_test.go (99%) rename {registry => internal}/client/blob_writer.go (100%) rename {registry => internal}/client/blob_writer_test.go (100%) rename {registry => internal}/client/errors.go (98%) rename {registry => internal}/client/errors_test.go (100%) rename {registry => internal}/client/repository.go (99%) rename {registry => internal}/client/repository_test.go (100%) rename {registry => internal}/client/transport/http_reader.go (100%) rename {registry => internal}/client/transport/http_reader_test.go (100%) rename {registry => internal}/client/transport/transport.go (100%) diff --git a/registry/client/auth/api_version.go b/internal/client/auth/api_version.go similarity index 100% rename from registry/client/auth/api_version.go rename to internal/client/auth/api_version.go diff --git a/registry/client/auth/challenge/addr.go b/internal/client/auth/challenge/addr.go similarity index 100% rename from registry/client/auth/challenge/addr.go rename to internal/client/auth/challenge/addr.go diff --git a/registry/client/auth/challenge/authchallenge.go b/internal/client/auth/challenge/authchallenge.go similarity index 100% rename from registry/client/auth/challenge/authchallenge.go rename to internal/client/auth/challenge/authchallenge.go diff --git a/registry/client/auth/challenge/authchallenge_test.go b/internal/client/auth/challenge/authchallenge_test.go similarity index 100% rename from registry/client/auth/challenge/authchallenge_test.go rename to internal/client/auth/challenge/authchallenge_test.go diff --git a/registry/client/auth/session.go b/internal/client/auth/session.go similarity index 98% rename from registry/client/auth/session.go rename to internal/client/auth/session.go index b0879fb4..9669dfd0 100644 --- a/registry/client/auth/session.go +++ b/internal/client/auth/session.go @@ -11,9 +11,9 @@ import ( "sync" "time" - "github.com/distribution/distribution/v3/registry/client" - "github.com/distribution/distribution/v3/registry/client/auth/challenge" - "github.com/distribution/distribution/v3/registry/client/transport" + "github.com/distribution/distribution/v3/internal/client" + "github.com/distribution/distribution/v3/internal/client/auth/challenge" + "github.com/distribution/distribution/v3/internal/client/transport" ) var ( diff --git a/registry/client/auth/session_test.go b/internal/client/auth/session_test.go similarity index 99% rename from registry/client/auth/session_test.go rename to internal/client/auth/session_test.go index e424e0e2..aacf1ef7 100644 --- a/registry/client/auth/session_test.go +++ b/internal/client/auth/session_test.go @@ -9,8 +9,8 @@ import ( "testing" "time" - "github.com/distribution/distribution/v3/registry/client/auth/challenge" - "github.com/distribution/distribution/v3/registry/client/transport" + "github.com/distribution/distribution/v3/internal/client/auth/challenge" + "github.com/distribution/distribution/v3/internal/client/transport" "github.com/distribution/distribution/v3/testutil" ) diff --git a/registry/client/blob_writer.go b/internal/client/blob_writer.go similarity index 100% rename from registry/client/blob_writer.go rename to internal/client/blob_writer.go diff --git a/registry/client/blob_writer_test.go b/internal/client/blob_writer_test.go similarity index 100% rename from registry/client/blob_writer_test.go rename to internal/client/blob_writer_test.go diff --git a/registry/client/errors.go b/internal/client/errors.go similarity index 98% rename from registry/client/errors.go rename to internal/client/errors.go index 9d20b8b7..4077f373 100644 --- a/registry/client/errors.go +++ b/internal/client/errors.go @@ -8,8 +8,8 @@ import ( "mime" "net/http" + "github.com/distribution/distribution/v3/internal/client/auth/challenge" "github.com/distribution/distribution/v3/registry/api/errcode" - "github.com/distribution/distribution/v3/registry/client/auth/challenge" ) // ErrNoErrorsInBody is returned when an HTTP response body parses to an empty diff --git a/registry/client/errors_test.go b/internal/client/errors_test.go similarity index 100% rename from registry/client/errors_test.go rename to internal/client/errors_test.go diff --git a/registry/client/repository.go b/internal/client/repository.go similarity index 99% rename from registry/client/repository.go rename to internal/client/repository.go index d39af256..4080ec13 100644 --- a/registry/client/repository.go +++ b/internal/client/repository.go @@ -15,8 +15,8 @@ import ( "time" "github.com/distribution/distribution/v3" + "github.com/distribution/distribution/v3/internal/client/transport" v2 "github.com/distribution/distribution/v3/registry/api/v2" - "github.com/distribution/distribution/v3/registry/client/transport" "github.com/distribution/distribution/v3/registry/storage/cache" "github.com/distribution/distribution/v3/registry/storage/cache/memory" "github.com/distribution/reference" diff --git a/registry/client/repository_test.go b/internal/client/repository_test.go similarity index 100% rename from registry/client/repository_test.go rename to internal/client/repository_test.go diff --git a/registry/client/transport/http_reader.go b/internal/client/transport/http_reader.go similarity index 100% rename from registry/client/transport/http_reader.go rename to internal/client/transport/http_reader.go diff --git a/registry/client/transport/http_reader_test.go b/internal/client/transport/http_reader_test.go similarity index 100% rename from registry/client/transport/http_reader_test.go rename to internal/client/transport/http_reader_test.go diff --git a/registry/client/transport/transport.go b/internal/client/transport/transport.go similarity index 100% rename from registry/client/transport/transport.go rename to internal/client/transport/transport.go diff --git a/registry/proxy/proxyauth.go b/registry/proxy/proxyauth.go index 07d80b48..ee79ed7e 100644 --- a/registry/proxy/proxyauth.go +++ b/registry/proxy/proxyauth.go @@ -6,8 +6,8 @@ import ( "strings" "github.com/distribution/distribution/v3/context" - "github.com/distribution/distribution/v3/registry/client/auth" - "github.com/distribution/distribution/v3/registry/client/auth/challenge" + "github.com/distribution/distribution/v3/internal/client/auth" + "github.com/distribution/distribution/v3/internal/client/auth/challenge" ) const challengeHeader = "Docker-Distribution-Api-Version" diff --git a/registry/proxy/proxymanifeststore_test.go b/registry/proxy/proxymanifeststore_test.go index 2ac325d4..026cb069 100644 --- a/registry/proxy/proxymanifeststore_test.go +++ b/registry/proxy/proxymanifeststore_test.go @@ -7,9 +7,9 @@ import ( "testing" "github.com/distribution/distribution/v3" + "github.com/distribution/distribution/v3/internal/client/auth" + "github.com/distribution/distribution/v3/internal/client/auth/challenge" "github.com/distribution/distribution/v3/manifest/schema2" - "github.com/distribution/distribution/v3/registry/client/auth" - "github.com/distribution/distribution/v3/registry/client/auth/challenge" "github.com/distribution/distribution/v3/registry/proxy/scheduler" "github.com/distribution/distribution/v3/registry/storage" "github.com/distribution/distribution/v3/registry/storage/cache/memory" diff --git a/registry/proxy/proxyregistry.go b/registry/proxy/proxyregistry.go index 8420138f..15dc783b 100644 --- a/registry/proxy/proxyregistry.go +++ b/registry/proxy/proxyregistry.go @@ -11,10 +11,10 @@ import ( "github.com/distribution/distribution/v3" "github.com/distribution/distribution/v3/configuration" dcontext "github.com/distribution/distribution/v3/context" - "github.com/distribution/distribution/v3/registry/client" - "github.com/distribution/distribution/v3/registry/client/auth" - "github.com/distribution/distribution/v3/registry/client/auth/challenge" - "github.com/distribution/distribution/v3/registry/client/transport" + "github.com/distribution/distribution/v3/internal/client" + "github.com/distribution/distribution/v3/internal/client/auth" + "github.com/distribution/distribution/v3/internal/client/auth/challenge" + "github.com/distribution/distribution/v3/internal/client/transport" "github.com/distribution/distribution/v3/registry/proxy/scheduler" "github.com/distribution/distribution/v3/registry/storage" "github.com/distribution/distribution/v3/registry/storage/driver"