Documentation ¶
Overview ¶
Package imagename provides docker data structure for docker image names It also provides a number of utility functions, related to image name resolving, comparison, and semver functionality.
Index ¶
- Constants
- func ParseRepositoryTag(repos string) (string, string)
- func WarnIfOldS3ImageName(imageName string) (bool, string)
- type Artifact
- type Artifacts
- type ImageName
- func (img ImageName) All() bool
- func (img ImageName) Contains(b *ImageName) bool
- func (img ImageName) GetECRRegion() string
- func (img ImageName) GetTag() string
- func (img ImageName) HasTag() bool
- func (img ImageName) HasVersion() bool
- func (img ImageName) HasVersionRange() bool
- func (img ImageName) IsECR() bool
- func (img ImageName) IsSameKind(b ImageName) bool
- func (img ImageName) IsStrict() bool
- func (img ImageName) MarshalJSON() ([]byte, error)
- func (img ImageName) MarshalYAML() (interface{}, error)
- func (img ImageName) NameWithRegistry() string
- func (img *ImageName) ResolveVersion(list []*ImageName, strictS3Match bool) (result *ImageName)
- func (img *ImageName) SetTag(tag string)
- func (img ImageName) String() string
- func (img ImageName) TagAsVersion() (ver *semver.Version)
- func (img ImageName) TagIsDigest() bool
- func (img ImageName) TagIsSha() bool
- func (img *ImageName) UnmarshalJSON(data []byte) error
- func (img *ImageName) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Tag
- type Tags
Constants ¶
const ( // Latest is :latest tag value Latest = "latest" // Wildcards is wildcard value variants Wildcards = "x*" )
const ( // StorageRegistry is when docker registry is used as images storage StorageRegistry = "registry" // StorageS3 is when s3 registry is used as images storage StorageS3 = "s3" )
Variables ¶
This section is empty.
Functions ¶
func ParseRepositoryTag ¶
ParseRepositoryTag gets a repos name and returns the right reposName + tag|digest The tag can be confusing because of a port in a repository name.
Ex: localhost.localdomain:5000/samalba/hipache:latest Digest ex: localhost:5000/foo/bar@sha256:bc8813ea7b3603864987522f02a76101c17ad122e1c46d790efc0fca78ca7bfb
NOTE: borrowed from Docker under Apache 2.0, Copyright 2013-2015 Docker, Inc.
func WarnIfOldS3ImageName ¶
WarnIfOldS3ImageName Check whether old image format is used. Also return warning message if yes
Types ¶
type Artifact ¶
type Artifact struct { Name *ImageName `yaml:"Name"` Pushed bool `yaml:"Pushed"` Tag string `yaml:"Tag"` Digest string `yaml:"Digest"` ImageID string `yaml:"ImageID"` Addressable string `yaml:"Addressable"` BuildTime time.Time `yaml:"BuildTime"` }
Artifact represents the artifact that is the result of image build It holds information about the pushed image and may be saved as a file
func (*Artifact) GetFileName ¶
GetFileName constructs the base file name out of the image info
type Artifacts ¶
type Artifacts struct {
RockerArtifacts []Artifact `yaml:"RockerArtifacts"`
}
Artifacts is a collection of Artifact entities
type ImageName ¶
type ImageName struct { Registry string Name string Tag string Storage string Version *semver.Range IsOldS3Name bool }
ImageName is the data structure with describes docker image name
func NewFromString ¶
NewFromString parses a given string and returns ImageName
func (ImageName) All ¶
All returns true if tag of the current image refers to any version Example: golang:* == true golang == true golang:latest == false
func (ImageName) Contains ¶
Contains returns true if the current image tag wildcard satisfies a given image version
func (ImageName) GetECRRegion ¶
GetECRRegion returns the regoin of the AWS ECR registry
func (ImageName) HasVersion ¶
HasVersion returns true if tag of the current image refers to a semver format Example: golang:1.5.1 == true golang:1.5.* == false golang:stable == false golang:latest == false
func (ImageName) HasVersionRange ¶
HasVersionRange returns true if tag of the current image refers to a semver format and is fuzzy Example: golang:1.5.1 == true golang:1.5.* == true golang:* == true golang:stable == false golang:latest == false golang == false
func (ImageName) IsSameKind ¶
IsSameKind returns true if current image and the given one are same but may have different versions (tags)
func (ImageName) IsStrict ¶
IsStrict returns true if tag of the current image is specified and contains no fuzzy rules Example: golang:latest == true golang:stable == true golang:1.5.1 == true golang:1.5.* == false golang == false
func (ImageName) MarshalJSON ¶
MarshalJSON serializes ImageName to JSON string
func (ImageName) MarshalYAML ¶
MarshalYAML serializes ImageName to YAML string
func (ImageName) NameWithRegistry ¶
NameWithRegistry returns the [registry/]name of the current image name
func (*ImageName) ResolveVersion ¶
ResolveVersion finds an applicable tag for current image among the list of available tags
func (ImageName) TagAsVersion ¶
TagAsVersion return semver.Version of the current image tag in case it's in semver format
func (ImageName) TagIsDigest ¶
TagIsDigest returns true if the tag is content addressable sha256 e.g. golang@sha256:ead434cd278824865d6e3b67e5d4579ded02eb2e8367fc165efa21138b225f11
func (ImageName) TagIsSha ¶
TagIsSha returns true if the tag is content addressable sha256 but can also be a tag e.g. golang@sha256:ead434cd278824865d6e3b67e5d4579ded02eb2e8367fc165efa21138b225f11 or golang:sha256-ead434cd278824865d6e3b67e5d4579ded02eb2e8367fc165efa21138b225f11
func (*ImageName) UnmarshalJSON ¶
UnmarshalJSON parses JSON string and returns ImageName
func (*ImageName) UnmarshalYAML ¶
UnmarshalYAML parses YAML string and returns ImageName
type Tags ¶
type Tags struct {
Items []*Tag
}
Tags is a structure used for cleaning images Sorts out old tags by creation date
func (*Tags) GetOld ¶
GetOld returns the list of items older then [keep] newest items sorted by Created date