image

package
v2.67.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WerfLabelPrefix                        = "werf"
	WerfLabel                              = "werf"
	WerfVersionLabel                       = "werf-version"
	WerfStageContentDigestLabel            = "werf-stage-content-digest"
	WerfProjectRepoCommitLabel             = "werf-project-repo-commit"
	WerfImportChecksumLabelPrefix          = "werf-import-checksum-"
	WerfImportSourceStageIDLabelPrefix     = "werf-import-source-stage-id-"
	WerfImportSourceExternalImagePrefix    = "external-image"
	WerfDependencySourceStageIDLabelPrefix = "werf-dependency-stage-id-"
	WerfBaseImageIDLabel                   = "werf.io/base-image-id"
	WerfParentStageID                      = "werf.io/parent-stage-id"

	WerfImportMetadataChecksumLabel       = "checksum"
	WerfImportMetadataSourceStageIDLabel  = "source-stage-id"
	WerfImportMetadataImportSourceIDLabel = "import-source-id"

	WerfCustomTagMetadataStageIDLabel = "stage-id"
	WerfCustomTagMetadataTag          = "tag"

	WerfMountTmpDirLabel          = "werf-mount-type-tmp-dir"
	WerfMountBuildDirLabel        = "werf-mount-type-build-dir"
	WerfMountCustomDirLabelPrefix = "werf-mount-type-custom-dir-"

	BuildCacheVersion = "1.2"

	StageContainerNamePrefix        = "werf.build."
	ImportServerContainerNamePrefix = "import-server-"
	AssemblingContainerNamePrefix   = "werf.stapel."
)
View Source
const (
	DockerHubRepositoryPrefix      = "docker.io/library/"
	IndexDockerHubRepositoryPrefix = "index.docker.io/library/"
)
View Source
const (
	ManifestCacheVersion = "5"
)

Variables

This section is empty.

Functions

func BuildImageValuesMap added in v2.65.0

func BuildImageValuesMap(infoGetter *InfoGetter) (map[string]interface{}, error)

func BuildStubImageValuesMap added in v2.65.0

func BuildStubImageValuesMap(repo, tag string) map[string]interface{}

func ExtractRepoDigest

func ExtractRepoDigest(inspectRepoDigests []string, repository string) string

ExtractRepoDigest return repo@digest from the list.

func GetDigestAndCreationTsFromLocalStageImageTag added in v2.60.0

func GetDigestAndCreationTsFromLocalStageImageTag(repoStageImageTag string) (string, int64, error)

func Init

func Init() error

func MustParseTimestampString

func MustParseTimestampString(timestampString string) time.Time

func MutateAndPushImage added in v2.53.0

func MutateAndPushImage(ctx context.Context, storage Storage, sourceReference, destinationReference string, newConfig SpecConfig) error

func NormalizeRepository

func NormalizeRepository(repository string) (res string)

func ParseCreationTs added in v2.6.6

func ParseCreationTs(creationTs string) (int64, error)

func ParseRepositoryAndTag

func ParseRepositoryAndTag(ref string) (string, string)

func UpdateConfigFile added in v2.53.0

func UpdateConfigFile(updates SpecConfig, target *v1.ConfigFile)

Types

type Container

type Container struct {
	ID      string
	ImageID string
	Names   []string
}

func (Container) LogName

func (container Container) LogName() string

type ContainerFilter

type ContainerFilter struct {
	ID       string
	Name     string
	Ancestor string
}

type ContainerList

type ContainerList []Container

type CustomTagFunc

type CustomTagFunc func(string, string) string

type ExportTagFunc

type ExportTagFunc func(string, string) string

type HealthConfig added in v2.24.0

type HealthConfig struct {
	Test        []string      `json:",omitempty"`
	Interval    time.Duration `json:",omitempty"`
	Timeout     time.Duration `json:",omitempty"`
	StartPeriod time.Duration `json:",omitempty"`
	Retries     int           `json:",omitempty"`
}

type ImagesList

type ImagesList []Summary

func (ImagesList) ConvertToStages

func (list ImagesList) ConvertToStages() ([]StageID, error)

FIXME(multiarch): take into account multiarch stages, which does not use creationTs

type Info

type Info struct {
	Name       string `json:"name"`
	Repository string `json:"repository"`
	Tag        string `json:"tag"`
	// FIXME remove RepoDigest from Info and use Digest everywhere instead cause it's more clear and repo part is not needed.
	// repo@sha256:digest
	RepoDigest string `json:"repoDigest"`

	OnBuild           []string            `json:"onBuild"`
	Env               []string            `json:"env"`
	ID                string              `json:"ID"`
	ParentID          string              `json:"parentID"`
	Labels            map[string]string   `json:"labels"`
	Size              int64               `json:"size"`
	CreatedAtUnixNano int64               `json:"createdAtUnixNano"`
	Volumes           map[string]struct{} `json:"volumes"`

	IsIndex bool
	Index   []*Info
}

func (*Info) GetCopy

func (info *Info) GetCopy() *Info

func (*Info) GetCreatedAt

func (info *Info) GetCreatedAt() time.Time

func (*Info) GetDigest

func (info *Info) GetDigest() string

func (*Info) LogName

func (info *Info) LogName() string

func (*Info) SetCreatedAtUnix

func (info *Info) SetCreatedAtUnix(seconds int64)

func (*Info) SetCreatedAtUnixNano

func (info *Info) SetCreatedAtUnixNano(seconds int64)

type InfoGetter

type InfoGetter struct {
	WerfImageName string
	Repo          string
	Tag           string
	Digest        string

	InfoGetterOptions
}

func NewInfoGetter

func NewInfoGetter(imageName, ref, digest string, opts InfoGetterOptions) *InfoGetter

func (*InfoGetter) GetName

func (d *InfoGetter) GetName() string

func (*InfoGetter) GetTag

func (d *InfoGetter) GetTag() string

func (*InfoGetter) GetWerfImageName

func (d *InfoGetter) GetWerfImageName() string

func (*InfoGetter) IsNameless

func (d *InfoGetter) IsNameless() bool

type InfoGetterOptions

type InfoGetterOptions struct {
	CustomTagFunc CustomTagFunc
	OnlyFinal     bool
}

type ManifestCache

type ManifestCache struct {
	CacheDir string
}
var CommonManifestCache *ManifestCache

func NewManifestCache

func NewManifestCache(cacheDir string) *ManifestCache

func (*ManifestCache) DeleteImageInfo added in v2.62.2

func (cache *ManifestCache) DeleteImageInfo(ctx context.Context, storageName, imageName string) error

func (*ManifestCache) GetImageInfo

func (cache *ManifestCache) GetImageInfo(ctx context.Context, storageName, imageName string) (*Info, error)

func (*ManifestCache) StoreImageInfo

func (cache *ManifestCache) StoreImageInfo(ctx context.Context, storageName string, imgInfo *Info) error

type ManifestCacheRecord

type ManifestCacheRecord struct {
	AccessTimestamp int64
	Info            *Info
}

type SpecConfig added in v2.53.0

type SpecConfig struct {
	Created         string              `json:"created"`
	Author          string              `json:"author"`
	User            string              `json:"User"`
	ExposedPorts    map[string]struct{} `json:"ExposedPorts"`
	Env             []string            `json:"Env"`
	Entrypoint      []string            `json:"Entrypoint"`
	Cmd             []string            `json:"Cmd"`
	Volumes         map[string]struct{} `json:"Volumes"`
	WorkingDir      string              `json:"WorkingDir"`
	Labels          map[string]string   `json:"Labels"`
	StopSignal      string              `json:"StopSignal"`
	HealthConfig    *HealthConfig       `json:"Healthcheck,omitempty"`
	ClearHistory    bool
	ClearCmd        bool
	ClearEntrypoint bool
	ClearUser       bool
	ClearWorkingDir bool
}

ImageSpecConfig represents OCI image configuration https://github.com/opencontainers/image-spec/blob/main/config.md

type StageDesc added in v2.14.0

type StageDesc struct {
	StageID *StageID `json:"stageID"`
	Info    *Info    `json:"info"`
}

func (*StageDesc) GetCopy added in v2.14.0

func (desc *StageDesc) GetCopy() *StageDesc

type StageDescSet added in v2.14.0

type StageDescSet mapset.Set[*StageDesc]

func NewStageDescSet added in v2.14.0

func NewStageDescSet(descList ...*StageDesc) StageDescSet

type StageID

type StageID struct {
	Digest string `json:"digest"`

	// FIXME: rename to CreationTs / update cacheVersion
	CreationTs      int64 `json:"uniqueID"`
	IsMultiplatform bool  `json:"isMultiplatform"`
}

func NewStageID

func NewStageID(digest string, creationTs int64) *StageID

func (StageID) CreationTsToTime added in v2.6.6

func (id StageID) CreationTsToTime() time.Time

func (StageID) IsEqual

func (id StageID) IsEqual(another StageID) bool

func (StageID) String

func (id StageID) String() string

type Storage added in v2.53.0

type Storage interface {
	MutateAndPushImage(ctx context.Context, src, dest string, newConfig SpecConfig) error
}

type Summary

type Summary struct {
	ID          string
	RepoTags    []string
	RepoDigests []string
	Labels      map[string]string
	Created     time.Time
	Size        int64
}

Jump to

Keyboard shortcuts

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