firstparty

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package firstparty provides functions for getting digests from registries supported by docker-lock's maintainers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllWrappers

func AllWrappers(
	client *registry.HTTPClient,
	configPath string,
) []registry.Wrapper

AllWrappers returns all wrappers officially supported by the maintainers of docker-lock, that match the caller's environment.

func DefaultWrapper

func DefaultWrapper(
	client *registry.HTTPClient,
	configPath string,
) (registry.Wrapper, error)

DefaultWrapper returns a wrapper for images without a prefix.

Types

type ACRWrapper

type ACRWrapper struct {
	*registry.AuthCredentials
	// contains filtered or unexported fields
}

ACRWrapper is a registry wrapper for Azure Container Registry.

func NewACRWrapper

func NewACRWrapper(
	client *registry.HTTPClient,
	configPath string,
	username string,
	password string,
	registryName string,
) (*ACRWrapper, error)

NewACRWrapper creates an ACRWrapper or returns an error if not possible.

registryName must not be empty. If your image is referenced by the line myregistry.azurecr.io/myimage, "myregistry" should be registryName's value.

If username and password are defined, then they will be used for authentication. Otherwise, the username and password will be obtained from docker's config.json. For this to work, please login using 'docker login' such as 'docker login myregistry.azurecr.io'.

If using the cli, to set the registry name, username, and password, ensure ACR_REGISTRY_NAME, ACR_USERNAME, and ACR_PASSWORD are set. This can be achieved automatically via a .env file or manually by exporting the environment variables. configPath can be set via cli flags.

func (*ACRWrapper) Digest

func (a *ACRWrapper) Digest(repo string, ref string) (string, error)

Digest queries the container registry for the digest given a repo and ref.

func (*ACRWrapper) Prefix

func (a *ACRWrapper) Prefix() string

Prefix returns the registry prefix that identifies ACR.

type DockerWrapper

type DockerWrapper struct {
	*registry.AuthCredentials
	// contains filtered or unexported fields
}

DockerWrapper is a registry wrapper for Docker Hub. It supports public and private repositories.

func NewDockerWrapper

func NewDockerWrapper(
	client *registry.HTTPClient,
	configPath string,
	username string,
	password string,
) (*DockerWrapper, error)

NewDockerWrapper creates a DockerWrapper or returns an error if not possible.

If username and password are defined, then they will be used for authentication. Otherwise, the username and password will be obtained from docker's config.json. For this to work, please login using 'docker login'.

If using the cli, to set the username and password, ensure DOCKER_USERNAME and DOCKER_PASSWORD are set. This can be achieved automatically via a .env file or manually by exporting the environment variables. configPath can be set via cli flags.

func (*DockerWrapper) Digest

func (d *DockerWrapper) Digest(repo string, ref string) (string, error)

Digest queries the container registry for the digest given a repo and ref.

func (*DockerWrapper) Prefix

func (d *DockerWrapper) Prefix() string

Prefix returns an empty string since images on Docker Hub do not use a prefix, unlike third party registries.

type InternalWrapper

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

InternalWrapper is a registry wrapper for internal registries.

func NewInternalWrapper

func NewInternalWrapper(
	client *registry.HTTPClient,
	prefix string,
	stripPrefix bool,
	registryURL string,
	tokenURL string,
) (*InternalWrapper, error)

NewInternalWrapper creates an InternalWrapper. If tokenURL is blank, the wrapper will not acquire a token before requesting the digest. If stripPrefix is true, the prefix will not be considered part of the repo name in API calls. registryURL must be set.

func (*InternalWrapper) Digest

func (i *InternalWrapper) Digest(repo string, ref string) (string, error)

Digest queries the container registry for the digest given a repo and ref.

func (*InternalWrapper) Prefix

func (i *InternalWrapper) Prefix() string

Prefix returns the registry prefix that identifies the internal registry.

Jump to

Keyboard shortcuts

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