Documentation
¶
Overview ¶
Package imageref manipulates container image references as strings: it expands docker shorthand the way container runtimes do, splits a reference into repository, tag and digest (tolerating registry ports and pinned digests), applies source-registry rewrites, and matches shell-style glob patterns against references.
Everything here is pure string manipulation — no registry access. The mirror engine records canonical (normalized, un-rewritten) references in its lock files; rewrites only ever affect where a pull is made from.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Normalize ¶
Normalize expands shorthand image references the way container runtimes do: a bare name gains docker.io/library/, a path without a registry host gains docker.io/, and a single-segment docker.io path gains library/.
func PathMatch ¶ added in v0.13.0
PathMatch reports whether value matches a path-aware glob pattern: '*' matches any run of characters within one '/'-separated segment, '**' matches any run including '/', and '?' matches exactly one character other than '/'. A "**/" that begins a segment also matches zero segments, so "ghcr.io/**/app" matches both ghcr.io/app and ghcr.io/a/b/app. No other metacharacters are supported.
It is the one glob dialect of every reference pattern list — images.exclude, images.verifyUpstream match, ociRefs.allow and the source policies — so a segment boundary always holds ("ghcr.io/acme/*" never reaches into ghcr.io/acme/team/app).
func Rewrite ¶
Rewrite routes a pull through a per-host rewrite (e.g. a pull-through cache in front of docker.io) when one is configured for the reference's registry host. References whose host has no rewrite pass through unchanged; recorded sources and publish targets always keep the canonical name.
Types ¶
type Ref ¶
type Ref struct {
// Repository is the registry host plus path, e.g. "ghcr.io/acme/app".
Repository string
// Tag is the tag portion, "latest" when the reference carries none.
Tag string
// Digest is the "sha256:..." pin when present, empty otherwise.
Digest string
}
Ref is a container image reference split into its addressable parts. Repository always carries an explicit registry host (Normalize first when the input may be shorthand).