image

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidatePlatformConstraint

func ValidatePlatformConstraint(platformStr string) bool

ValidatePlatformConstraint returns a boolean indicating whether the provided platform constraint string is valid.

Types

type Credentials

type Credentials struct {
	// Username identifies a principal, which combined with the value of the
	// Password field, can be used for reading from some image repository.
	Username string
	// Password, when combined with the principal identified by the Username
	// field, can be used for reading from some image repository.
	Password string
	// contains filtered or unexported fields
}

Credentials represents the credentials for connecting to a private image repository. It implements the distribution/V3/registry/client/auth.CredentialStore interface.

func (Credentials) Basic

func (c Credentials) Basic(*url.URL) (string, string)

Basic implements distribution/V3/registry/client/auth.CredentialStore.

func (Credentials) RefreshToken

func (c Credentials) RefreshToken(_ *url.URL, service string) string

RefreshToken implements distribution/V3/registry/client/auth.CredentialStore.

func (Credentials) SetRefreshToken

func (c Credentials) SetRefreshToken(_ *url.URL, service, token string)

SetRefreshToken implements distribution/V3/registry/client/auth.CredentialStore.

type Tag

type Tag struct {
	Name      string
	Digest    digest.Digest
	CreatedAt *time.Time
	// contains filtered or unexported fields
}

Tag is a representation of a container image Tag.

type TagSelectionStrategy

type TagSelectionStrategy string

TagSelectionStrategy represents a strategy for selecting a single tag from a container image repository.

const (
	// TagSelectionStrategyDigest represents a tag selection strategy that is
	// useful for finding the digest of a container image that is currently
	// referenced by a mutable tag, e.g. latest. This strategy requires the use of
	// a constraint that must exactly match the name of a, presumably, mutable
	// tag.
	TagSelectionStrategyDigest TagSelectionStrategy = "Digest"
	// TagSelectionStrategyLexical represents a tag selection strategy that
	// is useful for finding the tag that is lexically last among those matched
	// by a regular expression and not explicitly ignored. This strategy is useful
	// for finding the latest in a series of tag names that are suffixed with a
	// predictably formatted timestamp.
	TagSelectionStrategyLexical TagSelectionStrategy = "Lexical"
	// TagSelectionStrategyNewestBuild represents a tag selection strategy that is
	// useful for finding the tag that was most recently pushed to the image
	// repository. This is the east efficient strategy because it can require the
	// retrieval of many manifests from the image repository. It is best to use
	// this strategy with caution and constrain the eligible tags as much as
	// possible using a regular expression.
	TagSelectionStrategyNewestBuild TagSelectionStrategy = "NewestBuild"
	// TagSelectionStrategySemVer represents a tag selection strategy that is
	// useful for finding the tag is the highest among tags from the repository
	// that are valid semantic versions. An optional constraint can limit the
	// eligible range of semantic versions.
	TagSelectionStrategySemVer TagSelectionStrategy = "SemVer"
)

type TagSelector

type TagSelector interface {
	// SelectTag selects a single tag from a container image repository.
	SelectTag(context.Context) (*Tag, error)
}

TagSelector is an interface for selecting a single tag from a container image repository.

func NewTagSelector

func NewTagSelector(
	repoURL string,
	strategy TagSelectionStrategy,
	opts *TagSelectorOptions,
) (TagSelector, error)

NewTagSelector returns some implementation of the TagSelector interface that selects a single tag from a container image repository based on a tag selection strategy and a set of optional constraints.

type TagSelectorOptions

type TagSelectorOptions struct {
	// Constraint holds a selection strategy-specific value for constraining the
	// eligible tags.
	Constraint string
	// AllowRegex is an optional regular expression that can be used to constrain
	// the eligible tags.
	AllowRegex string
	// Ignore is an optional list of tag names that should explicitly be ignored.
	Ignore []string
	// Platform is an optional platform constraint. If specified, it does not
	// impact what tags are eligible for selection, but the selected tag must
	// match the platform constraint or TagSelector implementations will return
	// nil a tag.
	Platform string
	// Creds holds optional credentials for authenticating to the image
	// repository.
	Creds *Credentials
}

TagSelectorOptions represents options for creating a TagSelector.

Jump to

Keyboard shortcuts

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