Documentation
¶
Overview ¶
Package imageref renders machine-readable and human-friendly references for image-type component builds.
All builds for image components (Docker builds, external images) populate a common set of source-identity fields on the build record:
- SourceImage — repo only, e.g. "nginx"
- SourceRef — what the user wrote, e.g. "nginx:1.25.3"
- ResolvedTag — the tag the runner actually pulled, e.g. "1.25.5"
- SourceDigest — manifest list digest, e.g. "sha256:abc..."
This package converts those fields into the canonical forms used across the platform:
- ImageRef for pod specs, Helm values, and rendered K8s manifests (always digest-only — `repo@sha256:...`)
- DisplayRef for Nuon plan output, dashboard, CLI, and audit logs (human-friendly — `repo:tag (sha256:short)`)
The package takes a primitive Source struct so that both ctl-api (which uses internal app models) and the CLI (which uses generated SDK models) can call it without importing each other.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisplayRef ¶
DisplayRef returns a human-friendly reference for plan output, the dashboard, the CLI, and audit logs. The form is:
repo:tag (sha256:abcdef0)
Tag preference is ResolvedTag → tag parsed from SourceRef → none. When no tag is available the result falls back to a digest-only display:
repo@sha256:abcdef0
When both digest and tag are unavailable, falls back to whichever of SourceRef or SourceImage is set (keeps the function safe to call on legacy builds without surfacing an empty string).
func ImageRef ¶
ImageRef returns the canonical machine-readable reference for use in Kubernetes pod specs, Helm values, and rendered manifests. The reference is always digest-only:
nginx@sha256:abc...
Returns "" when the build has no SourceDigest. Callers should fall back to legacy behavior when the result is empty.
Types ¶
type Source ¶
type Source struct {
// SourceImage is the bare repository portion of the user's spec,
// e.g. "nginx" or "ghcr.io/nuonco/foo". Always set for image builds.
SourceImage string
// SourceRef is the original reference the user wrote, e.g.
// "nginx:1.25.3" or "nginx@sha256:abc...". Always set for image builds.
SourceRef string
// ResolvedTag is the tag the runner actually pulled, when known.
// Empty for digest-pinned references (where the user wrote
// "repo@sha256:...").
ResolvedTag string
// SourceDigest is the manifest list digest of the resolved image.
// Empty for legacy builds without recorded source identity.
SourceDigest string
}
Source captures the image-source identity fields needed to render references for an image-type component build. ctl-api and the CLI populate this struct from their own ComponentBuild model types.