container

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const LoginFailureMessage string = "%s login failed for: %s.\n %s image must be in the form: registry-domain/path-in-repository/image-name:version."

Docker login error message

View Source
const MinSupportedApiVersion string = "1.31"

Docker API version 1.31 is compatible with Docker version 17.07.0, according to https://docs.docker.com/engine/api/#api-version-matrix

Variables

View Source
var ApiVersionRegex = regexp.MustCompile(`^(\d+)\.(\d+)$`)

Search for docker API version format pattern e.g. 1.40

Functions

func ContainerManagerLogin

func ContainerManagerLogin(imageTag string, config *ContainerManagerLoginConfig, containerManager ContainerManagerType) error

First we'll try to login assuming a proxy-less tag (e.g. "registry-address/docker-repo/image:ver"). If fails, we will try assuming a reverse proxy tag (e.g. "registry-address-docker-repo/image:ver").

func GetImageTagWithDigest

func GetImageTagWithDigest(filePath string) (tag string, sha256 string, err error)

Read the file which contains the following format: 'IMAGE-TAG-IN-ARTIFACTORY'@sha256'SHA256-OF-THE-IMAGE-MANIFEST'.

func IsCompatibleApiVersion

func IsCompatibleApiVersion(dockerOutput string) bool

func ResolveRegistryFromTag

func ResolveRegistryFromTag(imageTag string) (string, error)

Get registry from tag

func ValidateClientApiVersion

func ValidateClientApiVersion() error

Types

type Builder

type Builder interface {
	Build(module string) (*buildinfo.BuildInfo, error)
}

Docker image build info builder.

func NewBuildInfoBuilder

func NewBuildInfoBuilder(image *Image, repository, buildName, buildNumber string, serviceManager artifactory.ArtifactoryServicesManager, commandType CommandType, containerManager ContainerManager) (Builder, error)

func NewKanikoBuildInfoBuilder

func NewKanikoBuildInfoBuilder(image *Image, repository, buildName, buildNumber string, serviceManager artifactory.ArtifactoryServicesManager, commandType CommandType, containerManager ContainerManager, manifestSha256 string) (Builder, error)

type CommandType

type CommandType string
const (
	Pull CommandType = "pull"
	Push CommandType = "push"
)

type ContainerManager

type ContainerManager interface {
	Push(image *Image) error
	Id(image *Image) (string, error)
	OsCompatibility(image *Image) (string, string, error)
	Pull(image *Image) error
	GetContainerManagerType() ContainerManagerType
}

Container image

func NewManager

func NewManager(containerManagerType ContainerManagerType) ContainerManager

type ContainerManagerLoginConfig

type ContainerManagerLoginConfig struct {
	ArtifactoryDetails *config.ArtifactoryDetails
}

type ContainerManagerType

type ContainerManagerType int
const (
	DockerClient ContainerManagerType = iota
	Podman
	Kaniko
)

func (ContainerManagerType) String

func (cmt ContainerManagerType) String() string

type FatManifest

type FatManifest struct {
	Manifests []ManifestDetails `json:"manifests"`
}

type Image

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

func NewImage

func NewImage(tag string) *Image

func (*Image) Name

func (image *Image) Name() string

Get image name.

func (*Image) Path

func (image *Image) Path() string

Get image relative path in Artifactory.

func (*Image) Tag

func (image *Image) Tag() string

Get image tag

type LoginCmd

type LoginCmd struct {
	DockerRegistry string
	Username       string
	Password       string
	// contains filtered or unexported fields
}

Login command

func (*LoginCmd) GetCmd

func (loginCmd *LoginCmd) GetCmd() *exec.Cmd

func (*LoginCmd) GetEnv

func (loginCmd *LoginCmd) GetEnv() map[string]string

func (*LoginCmd) GetErrWriter

func (loginCmd *LoginCmd) GetErrWriter() io.WriteCloser

func (*LoginCmd) GetStdWriter

func (loginCmd *LoginCmd) GetStdWriter() io.WriteCloser

type ManifestDetails

type ManifestDetails struct {
	Digest   string   `json:"digest"`
	Platform Platform `json:"platform"`
}

type Platform

type Platform struct {
	Architecture string `json:"architecture"`
	Os           string `json:"os"`
}

type RepositoryDetails

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

type VersionCmd

type VersionCmd struct{}

Version command Docker-client provides an API for interacting with the Docker daemon. This cmd should be used for docker client only.

func (*VersionCmd) GetCmd

func (versionCmd *VersionCmd) GetCmd() *exec.Cmd

func (*VersionCmd) GetEnv

func (versionCmd *VersionCmd) GetEnv() map[string]string

func (*VersionCmd) GetErrWriter

func (versionCmd *VersionCmd) GetErrWriter() io.WriteCloser

func (*VersionCmd) GetStdWriter

func (versionCmd *VersionCmd) GetStdWriter() io.WriteCloser

Jump to

Keyboard shortcuts

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