registry

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2021 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigurationMap = Map{}

ConfigurationMap is a global variable that maps registry name to config.

View Source
var DefaultDockerHubConfiguration = Config{
	Security: security.Config{
		TLS:       &httputil.TLSConfig{},
		BasicAuth: &security.BasicAuthConfig{},
	}}

DefaultDockerHubConfiguration contains docker hub registry configuration.

Functions

func UpdateGlobalConfig added in v0.1.11

func UpdateGlobalConfig(registryConfig string) error

UpdateGlobalConfig updates the global registry config given either: - a JSON string of the configuration - a path to a YAML file

Types

type Client

type Client interface {
	Pull(tag string) (*image.DistributionManifest, error)
	Push(tag string) error
	PullManifest(tag string) (*image.DistributionManifest, error)
	PushManifest(tag string, manifest *image.DistributionManifest) error
	PullLayer(layerDigest image.Digest) (os.FileInfo, error)
	PushLayer(layerDigest image.Digest) error
	PullImageConfig(layerDigest image.Digest) (os.FileInfo, error)
	PushImageConfig(layerDigest image.Digest) error
}

Client is the interface through which we can interact with a docker registry. It is used when pulling and pushing images to that registry.

func NoopClientFixture

func NoopClientFixture() Client

NoopClientFixture inits a new NoopClientFixture object for testing.

type Config

type Config struct {
	Concurrency     int           `yaml:"concurrency" json:"concurrency"`
	Timeout         time.Duration `yaml:"timeout" json:"timeout"`
	RetryDisabled   bool          `yaml:"retry_disabled" json:"retry_disabled"`
	Retries         uint64        `yaml:"retries" json:"retries"`
	RetryInterval   time.Duration `yaml:"retry_interval" json:"retry_interval"`
	RetryBackoff    float64       `yaml:"retry_backoff" json:"retry_backoff"`
	RetryBackoffMax time.Duration `yaml:"retry_backoff_max" json:"retry_backoff_max"`
	PushRate        float64       `yaml:"push_rate" json:"push_rate"`
	// If not specify, a default chunk size will be used.
	// Set it to -1 to turn off chunk upload.
	// NOTE: gcr and ecr do not support chunked upload.
	PushChunk int64           `yaml:"push_chunk" json:"push_chunk"`
	Security  security.Config `yaml:"security" json:"security"`
}

Config contains docker registry client configuration.

type DockerRegistryClient

type DockerRegistryClient struct {
	// contains filtered or unexported fields
}

DockerRegistryClient is a real registry client that is able to push and pull images. It uses a storage.ImageStore to interact with images on the local filesystem. It implements the Client interface.

func New

func New(store *storage.ImageStore, registry, repository string) *DockerRegistryClient

New returns a new default Client.

func NewWithClient

func NewWithClient(store *storage.ImageStore, registry, repository string, client *http.Client) *DockerRegistryClient

NewWithClient returns a new Client with a customized http.Client.

func PullClientFixture

func PullClientFixture(
	ctx *context.BuildContext, manifestPath, imageConfigPath, layerTarPath string,
) (*DockerRegistryClient, error)

PullClientFixture returns a new registry client fixture that can handle image pull requests.

func PullClientFixtureWithAlpine added in v0.1.12

func PullClientFixtureWithAlpine(ctx *context.BuildContext) (*DockerRegistryClient, error)

PullClientFixture returns a new registry client fixture that can handle image pull requests using a local alpine test image.

func PullClientFixtureWithAlpineDup added in v0.1.12

func PullClientFixtureWithAlpineDup(ctx *context.BuildContext) (*DockerRegistryClient, error)

PullClientFixture returns a new registry client fixture that can handle image pull requests using a local alpine test image that contains duplicate layers.

func PushClientFixture

func PushClientFixture(ctx *context.BuildContext, overrides ...responseOverride) (*DockerRegistryClient, error)

PushClientFixture returns a new registry client fixture that can handle image push requests.

func (DockerRegistryClient) Pull

Pull tries to pull an image from its docker registry. If the pull succeeded, it would store the image in the ImageStore of the client, and returns the distribution manifest.

func (DockerRegistryClient) PullImageConfig added in v0.1.7

func (c DockerRegistryClient) PullImageConfig(layerDigest image.Digest) (os.FileInfo, error)

PullImageConfig pulls image config blob from the registry. Same as PullLayer, with slightly different log message.

func (DockerRegistryClient) PullLayer

func (c DockerRegistryClient) PullLayer(layerDigest image.Digest) (os.FileInfo, error)

PullLayer pulls image layer from the registry, and verifies that the contents of that layer match the digest of the manifest. If the layer already exists in the imagestore, the download is skipped.

func (DockerRegistryClient) PullManifest

PullManifest pulls docker image manifest from the docker registry. It does not save the manifest to the store.

func (DockerRegistryClient) Push

func (c DockerRegistryClient) Push(tag string) error

Push tries to push an image to docker registry, using the ImageStore of the client.

func (DockerRegistryClient) PushImageConfig added in v0.1.7

func (c DockerRegistryClient) PushImageConfig(layerDigest image.Digest) error

PushImageConfig pushes image config blob to the registry. Same as PushLayer, with slightly different log message.

func (DockerRegistryClient) PushLayer

func (c DockerRegistryClient) PushLayer(layerDigest image.Digest) error

PushLayer pushes the image layer to the registry.

func (DockerRegistryClient) PushManifest

func (c DockerRegistryClient) PushManifest(tag string, manifest *image.DistributionManifest) error

PushManifest pushes the manifest to the registry.

type Map

type Map map[string]RepositoryMap

Map contains a map of registry config.

type RepositoryMap

type RepositoryMap map[string]Config

RepositoryMap contains a map of repo config. Repo name can be a regex.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL