Add own reference package wrapper
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>master
							parent
							
								
									35d767115c
								
							
						
					
					
						commit
						9b8f1a0895
					
				| 
						 | 
					@ -7,11 +7,12 @@ import (
 | 
				
			||||||
	"net/url"
 | 
						"net/url"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/docker/distribution/reference"
 | 
						distreference "github.com/docker/distribution/reference"
 | 
				
			||||||
	registrytypes "github.com/docker/docker/api/types/registry"
 | 
						registrytypes "github.com/docker/docker/api/types/registry"
 | 
				
			||||||
	"github.com/docker/docker/image/v1"
 | 
						"github.com/docker/docker/image/v1"
 | 
				
			||||||
	"github.com/docker/docker/opts"
 | 
						"github.com/docker/docker/opts"
 | 
				
			||||||
	flag "github.com/docker/docker/pkg/mflag"
 | 
						flag "github.com/docker/docker/pkg/mflag"
 | 
				
			||||||
 | 
						"github.com/docker/docker/reference"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Options holds command line options.
 | 
					// Options holds command line options.
 | 
				
			||||||
| 
						 | 
					@ -269,7 +270,7 @@ func GetAuthConfigKey(index *registrytypes.IndexInfo) string {
 | 
				
			||||||
// splitReposName breaks a reposName into an index name and remote name
 | 
					// splitReposName breaks a reposName into an index name and remote name
 | 
				
			||||||
func splitReposName(reposName reference.Named) (indexName string, remoteName reference.Named, err error) {
 | 
					func splitReposName(reposName reference.Named) (indexName string, remoteName reference.Named, err error) {
 | 
				
			||||||
	var remoteNameStr string
 | 
						var remoteNameStr string
 | 
				
			||||||
	indexName, remoteNameStr = reference.SplitHostname(reposName)
 | 
						indexName, remoteNameStr = distreference.SplitHostname(reposName)
 | 
				
			||||||
	if indexName == "" || (!strings.Contains(indexName, ".") &&
 | 
						if indexName == "" || (!strings.Contains(indexName, ".") &&
 | 
				
			||||||
		!strings.Contains(indexName, ":") && indexName != "localhost") {
 | 
							!strings.Contains(indexName, ":") && indexName != "localhost") {
 | 
				
			||||||
		// This is a Docker Index repos (ex: samalba/hipache or ubuntu)
 | 
							// This is a Docker Index repos (ex: samalba/hipache or ubuntu)
 | 
				
			||||||
| 
						 | 
					@ -405,13 +406,13 @@ func localNameFromRemote(indexName string, remoteName reference.Named) (referenc
 | 
				
			||||||
// error.
 | 
					// error.
 | 
				
			||||||
func NormalizeLocalReference(ref reference.Named) reference.Named {
 | 
					func NormalizeLocalReference(ref reference.Named) reference.Named {
 | 
				
			||||||
	localName := NormalizeLocalName(ref)
 | 
						localName := NormalizeLocalName(ref)
 | 
				
			||||||
	if tagged, isTagged := ref.(reference.Tagged); isTagged {
 | 
						if tagged, isTagged := ref.(reference.NamedTagged); isTagged {
 | 
				
			||||||
		newRef, err := reference.WithTag(localName, tagged.Tag())
 | 
							newRef, err := reference.WithTag(localName, tagged.Tag())
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return ref
 | 
								return ref
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return newRef
 | 
							return newRef
 | 
				
			||||||
	} else if digested, isDigested := ref.(reference.Digested); isDigested {
 | 
						} else if digested, isCanonical := ref.(reference.Canonical); isCanonical {
 | 
				
			||||||
		newRef, err := reference.WithDigest(localName, digested.Digest())
 | 
							newRef, err := reference.WithDigest(localName, digested.Digest())
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return ref
 | 
								return ref
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,9 +15,9 @@ import (
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/docker/distribution/reference"
 | 
					 | 
				
			||||||
	registrytypes "github.com/docker/docker/api/types/registry"
 | 
						registrytypes "github.com/docker/docker/api/types/registry"
 | 
				
			||||||
	"github.com/docker/docker/opts"
 | 
						"github.com/docker/docker/opts"
 | 
				
			||||||
 | 
						"github.com/docker/docker/reference"
 | 
				
			||||||
	"github.com/gorilla/mux"
 | 
						"github.com/gorilla/mux"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/Sirupsen/logrus"
 | 
						"github.com/Sirupsen/logrus"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,10 +8,10 @@ import (
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/docker/distribution/reference"
 | 
					 | 
				
			||||||
	"github.com/docker/distribution/registry/client/transport"
 | 
						"github.com/docker/distribution/registry/client/transport"
 | 
				
			||||||
	"github.com/docker/docker/api/types"
 | 
						"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/reference"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,10 +6,10 @@ import (
 | 
				
			||||||
	"net/url"
 | 
						"net/url"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/docker/distribution/reference"
 | 
					 | 
				
			||||||
	"github.com/docker/distribution/registry/client/auth"
 | 
						"github.com/docker/distribution/registry/client/auth"
 | 
				
			||||||
	"github.com/docker/docker/api/types"
 | 
						"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/reference"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Service is a registry service. It tracks configuration data such as a list
 | 
					// Service is a registry service. It tracks configuration data such as a list
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,8 +4,8 @@ import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/docker/distribution/reference"
 | 
					 | 
				
			||||||
	"github.com/docker/docker/pkg/tlsconfig"
 | 
						"github.com/docker/docker/pkg/tlsconfig"
 | 
				
			||||||
 | 
						"github.com/docker/docker/reference"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *Service) lookupV1Endpoints(repoName reference.Named) (endpoints []APIEndpoint, err error) {
 | 
					func (s *Service) lookupV1Endpoints(repoName reference.Named) (endpoints []APIEndpoint, err error) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,9 +4,9 @@ import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/docker/distribution/reference"
 | 
					 | 
				
			||||||
	"github.com/docker/distribution/registry/client/auth"
 | 
						"github.com/docker/distribution/registry/client/auth"
 | 
				
			||||||
	"github.com/docker/docker/pkg/tlsconfig"
 | 
						"github.com/docker/docker/pkg/tlsconfig"
 | 
				
			||||||
 | 
						"github.com/docker/docker/reference"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *Service) lookupV2Endpoints(repoName reference.Named) (endpoints []APIEndpoint, err error) {
 | 
					func (s *Service) lookupV2Endpoints(repoName reference.Named) (endpoints []APIEndpoint, err error) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,13 +19,13 @@ import (
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/Sirupsen/logrus"
 | 
						"github.com/Sirupsen/logrus"
 | 
				
			||||||
	"github.com/docker/distribution/reference"
 | 
					 | 
				
			||||||
	"github.com/docker/docker/api/types"
 | 
						"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/pkg/httputils"
 | 
						"github.com/docker/docker/pkg/httputils"
 | 
				
			||||||
	"github.com/docker/docker/pkg/ioutils"
 | 
						"github.com/docker/docker/pkg/ioutils"
 | 
				
			||||||
	"github.com/docker/docker/pkg/stringid"
 | 
						"github.com/docker/docker/pkg/stringid"
 | 
				
			||||||
	"github.com/docker/docker/pkg/tarsum"
 | 
						"github.com/docker/docker/pkg/tarsum"
 | 
				
			||||||
 | 
						"github.com/docker/docker/reference"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,8 @@
 | 
				
			||||||
package registry
 | 
					package registry
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"github.com/docker/distribution/reference"
 | 
					 | 
				
			||||||
	registrytypes "github.com/docker/docker/api/types/registry"
 | 
						registrytypes "github.com/docker/docker/api/types/registry"
 | 
				
			||||||
 | 
						"github.com/docker/docker/reference"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// RepositoryData tracks the image list, list of endpoints, and list of tokens
 | 
					// RepositoryData tracks the image list, list of endpoints, and list of tokens
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue