distribution: use types/registry.AuthConfig
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
a02abca49a
commit
04c339a12b
|
@ -8,7 +8,7 @@ import (
|
||||||
|
|
||||||
"github.com/docker/distribution"
|
"github.com/docker/distribution"
|
||||||
"github.com/docker/distribution/manifest/schema2"
|
"github.com/docker/distribution/manifest/schema2"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/registry"
|
||||||
"github.com/docker/docker/distribution/metadata"
|
"github.com/docker/docker/distribution/metadata"
|
||||||
"github.com/docker/docker/distribution/xfer"
|
"github.com/docker/docker/distribution/xfer"
|
||||||
"github.com/docker/docker/image"
|
"github.com/docker/docker/image"
|
||||||
|
@ -16,7 +16,7 @@ import (
|
||||||
"github.com/docker/docker/pkg/progress"
|
"github.com/docker/docker/pkg/progress"
|
||||||
"github.com/docker/docker/pkg/system"
|
"github.com/docker/docker/pkg/system"
|
||||||
refstore "github.com/docker/docker/reference"
|
refstore "github.com/docker/docker/reference"
|
||||||
"github.com/docker/docker/registry"
|
registrypkg "github.com/docker/docker/registry"
|
||||||
"github.com/docker/libtrust"
|
"github.com/docker/libtrust"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
@ -30,13 +30,13 @@ type Config struct {
|
||||||
MetaHeaders map[string][]string
|
MetaHeaders map[string][]string
|
||||||
// AuthConfig holds authentication credentials for authenticating with
|
// AuthConfig holds authentication credentials for authenticating with
|
||||||
// the registry.
|
// the registry.
|
||||||
AuthConfig *types.AuthConfig
|
AuthConfig *registry.AuthConfig
|
||||||
// ProgressOutput is the interface for showing the status of the pull
|
// ProgressOutput is the interface for showing the status of the pull
|
||||||
// operation.
|
// operation.
|
||||||
ProgressOutput progress.Output
|
ProgressOutput progress.Output
|
||||||
// RegistryService is the registry service to use for TLS configuration
|
// RegistryService is the registry service to use for TLS configuration
|
||||||
// and endpoint lookup.
|
// and endpoint lookup.
|
||||||
RegistryService registry.Service
|
RegistryService registrypkg.Service
|
||||||
// ImageEventLogger notifies events for a given image
|
// ImageEventLogger notifies events for a given image
|
||||||
ImageEventLogger func(id, name, action string)
|
ImageEventLogger func(id, name, action string)
|
||||||
// MetadataStore is the storage backend for distribution-specific
|
// MetadataStore is the storage backend for distribution-specific
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/registry"
|
||||||
"github.com/docker/docker/layer"
|
"github.com/docker/docker/layer"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
)
|
)
|
||||||
|
@ -69,7 +69,7 @@ func ComputeV2MetadataHMAC(key []byte, meta *V2Metadata) string {
|
||||||
|
|
||||||
// ComputeV2MetadataHMACKey returns a key for the given "authConfig" that can be used to hash v2 metadata
|
// ComputeV2MetadataHMACKey returns a key for the given "authConfig" that can be used to hash v2 metadata
|
||||||
// entries.
|
// entries.
|
||||||
func ComputeV2MetadataHMACKey(authConfig *types.AuthConfig) ([]byte, error) {
|
func ComputeV2MetadataHMACKey(authConfig *registry.AuthConfig) ([]byte, error) {
|
||||||
if authConfig == nil {
|
if authConfig == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import (
|
||||||
|
|
||||||
"github.com/docker/distribution/manifest/schema1"
|
"github.com/docker/distribution/manifest/schema1"
|
||||||
"github.com/docker/distribution/reference"
|
"github.com/docker/distribution/reference"
|
||||||
"github.com/docker/docker/api/types"
|
|
||||||
registrytypes "github.com/docker/docker/api/types/registry"
|
registrytypes "github.com/docker/docker/api/types/registry"
|
||||||
"github.com/docker/docker/image"
|
"github.com/docker/docker/image"
|
||||||
"github.com/docker/docker/registry"
|
"github.com/docker/docker/registry"
|
||||||
|
@ -351,7 +350,7 @@ func testNewPuller(t *testing.T, rawurl string) *puller {
|
||||||
imagePullConfig := &ImagePullConfig{
|
imagePullConfig := &ImagePullConfig{
|
||||||
Config: Config{
|
Config: Config{
|
||||||
MetaHeaders: http.Header{},
|
MetaHeaders: http.Header{},
|
||||||
AuthConfig: &types.AuthConfig{
|
AuthConfig: ®istrytypes.AuthConfig{
|
||||||
RegistryToken: secretRegistryToken,
|
RegistryToken: secretRegistryToken,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,12 +11,12 @@ import (
|
||||||
"github.com/docker/distribution/manifest/schema2"
|
"github.com/docker/distribution/manifest/schema2"
|
||||||
"github.com/docker/distribution/reference"
|
"github.com/docker/distribution/reference"
|
||||||
"github.com/docker/distribution/registry/api/errcode"
|
"github.com/docker/distribution/registry/api/errcode"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/registry"
|
||||||
"github.com/docker/docker/distribution/metadata"
|
"github.com/docker/docker/distribution/metadata"
|
||||||
"github.com/docker/docker/layer"
|
"github.com/docker/docker/layer"
|
||||||
"github.com/docker/docker/pkg/progress"
|
"github.com/docker/docker/pkg/progress"
|
||||||
refstore "github.com/docker/docker/reference"
|
refstore "github.com/docker/docker/reference"
|
||||||
"github.com/docker/docker/registry"
|
registrypkg "github.com/docker/docker/registry"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -515,7 +515,7 @@ func TestWhenEmptyAuthConfig(t *testing.T) {
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
imagePushConfig := &ImagePushConfig{}
|
imagePushConfig := &ImagePushConfig{}
|
||||||
imagePushConfig.AuthConfig = &types.AuthConfig{
|
imagePushConfig.AuthConfig = ®istry.AuthConfig{
|
||||||
Username: authInfo.username,
|
Username: authInfo.username,
|
||||||
Password: authInfo.password,
|
Password: authInfo.password,
|
||||||
RegistryToken: authInfo.registryToken,
|
RegistryToken: authInfo.registryToken,
|
||||||
|
@ -524,15 +524,15 @@ func TestWhenEmptyAuthConfig(t *testing.T) {
|
||||||
repoInfo, _ := reference.ParseNormalizedNamed("xujihui1985/test.img")
|
repoInfo, _ := reference.ParseNormalizedNamed("xujihui1985/test.img")
|
||||||
pusher := &pusher{
|
pusher := &pusher{
|
||||||
config: imagePushConfig,
|
config: imagePushConfig,
|
||||||
repoInfo: ®istry.RepositoryInfo{
|
repoInfo: ®istrypkg.RepositoryInfo{
|
||||||
Name: repoInfo,
|
Name: repoInfo,
|
||||||
},
|
},
|
||||||
endpoint: registry.APIEndpoint{
|
endpoint: registrypkg.APIEndpoint{
|
||||||
URL: &url.URL{
|
URL: &url.URL{
|
||||||
Scheme: "https",
|
Scheme: "https",
|
||||||
Host: "index.docker.io",
|
Host: "index.docker.io",
|
||||||
},
|
},
|
||||||
Version: registry.APIVersion2,
|
Version: registrypkg.APIVersion2,
|
||||||
TrimHostname: true,
|
TrimHostname: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"github.com/docker/distribution/registry/client"
|
"github.com/docker/distribution/registry/client"
|
||||||
"github.com/docker/distribution/registry/client/auth"
|
"github.com/docker/distribution/registry/client/auth"
|
||||||
"github.com/docker/distribution/registry/client/transport"
|
"github.com/docker/distribution/registry/client/transport"
|
||||||
"github.com/docker/docker/api/types"
|
registrytypes "github.com/docker/docker/api/types/registry"
|
||||||
"github.com/docker/docker/dockerversion"
|
"github.com/docker/docker/dockerversion"
|
||||||
"github.com/docker/docker/registry"
|
"github.com/docker/docker/registry"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
@ -58,7 +58,7 @@ func init() {
|
||||||
// remote API version.
|
// remote API version.
|
||||||
func newRepository(
|
func newRepository(
|
||||||
ctx context.Context, repoInfo *registry.RepositoryInfo, endpoint registry.APIEndpoint,
|
ctx context.Context, repoInfo *registry.RepositoryInfo, endpoint registry.APIEndpoint,
|
||||||
metaHeaders http.Header, authConfig *types.AuthConfig, actions ...string,
|
metaHeaders http.Header, authConfig *registrytypes.AuthConfig, actions ...string,
|
||||||
) (repo distribution.Repository, err error) {
|
) (repo distribution.Repository, err error) {
|
||||||
repoName := repoInfo.Name.Name()
|
repoName := repoInfo.Name.Name()
|
||||||
// If endpoint does not support CanonicalName, use the RemoteName instead
|
// If endpoint does not support CanonicalName, use the RemoteName instead
|
||||||
|
|
|
@ -9,9 +9,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/distribution/reference"
|
"github.com/docker/distribution/reference"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types/registry"
|
||||||
registrytypes "github.com/docker/docker/api/types/registry"
|
registrypkg "github.com/docker/docker/registry"
|
||||||
"github.com/docker/docker/registry"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -41,7 +40,7 @@ func testTokenPassThru(t *testing.T, ts *httptest.Server) {
|
||||||
t.Fatalf("could not parse url from test server: %v", err)
|
t.Fatalf("could not parse url from test server: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
endpoint := registry.APIEndpoint{
|
endpoint := registrypkg.APIEndpoint{
|
||||||
Mirror: false,
|
Mirror: false,
|
||||||
URL: uri,
|
URL: uri,
|
||||||
Version: 2,
|
Version: 2,
|
||||||
|
@ -50,9 +49,9 @@ func testTokenPassThru(t *testing.T, ts *httptest.Server) {
|
||||||
TLSConfig: nil,
|
TLSConfig: nil,
|
||||||
}
|
}
|
||||||
n, _ := reference.ParseNormalizedNamed("testremotename")
|
n, _ := reference.ParseNormalizedNamed("testremotename")
|
||||||
repoInfo := ®istry.RepositoryInfo{
|
repoInfo := ®istrypkg.RepositoryInfo{
|
||||||
Name: n,
|
Name: n,
|
||||||
Index: ®istrytypes.IndexInfo{
|
Index: ®istry.IndexInfo{
|
||||||
Name: "testrepo",
|
Name: "testrepo",
|
||||||
Mirrors: nil,
|
Mirrors: nil,
|
||||||
Secure: false,
|
Secure: false,
|
||||||
|
@ -63,7 +62,7 @@ func testTokenPassThru(t *testing.T, ts *httptest.Server) {
|
||||||
imagePullConfig := &ImagePullConfig{
|
imagePullConfig := &ImagePullConfig{
|
||||||
Config: Config{
|
Config: Config{
|
||||||
MetaHeaders: http.Header{},
|
MetaHeaders: http.Header{},
|
||||||
AuthConfig: &types.AuthConfig{
|
AuthConfig: ®istry.AuthConfig{
|
||||||
RegistryToken: secretRegistryToken,
|
RegistryToken: secretRegistryToken,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue