images

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckInput

type CheckInput struct {
	StackKey string                 // Stack key (e.g., "hetzner/traefik")
	Services map[string]ServiceSpec // service name -> image + per-service tag pattern
}

CheckInput bundles everything needed to check images for a stack.

type FileChange

type FileChange struct {
	StackKey string // Stack key (e.g., "hetzner/traefik")
	Service  string // Service name
	File     string // Path to compose file that was modified
	Image    string // Image name (without tag)
	OldTag   string // Previous tag
	NewTag   string // New tag written
}

FileChange represents a tag rewrite in a compose file.

func Upgrade

func Upgrade(results []ImageStatus, stackFiles map[string][]string) ([]FileChange, error)

Upgrade takes check results and a map of stack keys to compose file paths, rewrites the image tags in the compose files, and returns what changed.

Only results with non-empty NewerTags and no Error are processed. The new tag applied is NewerTags[0] (the newest available). File content is rewritten only when a change is detected.

type ImageStatus

type ImageStatus struct {
	Stack         string   // Stack key (e.g., "hetzner/traefik")
	Service       string   // Service name within the compose file
	Image         string   // Full image reference as written in compose
	CurrentTag    string   // Current tag
	DigestStale   bool     // True if remote digest differs from local
	NewerTags     []string // Newer semver tags (empty if no tag_pattern or no newer tags)
	HasTagPattern bool     // True if a dockform.tag_pattern label is set on this service
	Error         string   // Non-empty if check failed for this image
}

ImageStatus represents the check result for a single image.

func Check

func Check(ctx context.Context, inputs []CheckInput, reg registry.Registry, localDigestFn LocalDigestFunc) ([]ImageStatus, error)

Check scans all images across the provided inputs and compares them against registries for digest staleness and newer semver tags.

Errors for individual images are captured in ImageStatus.Error so that a single failing image does not abort the entire check. All images are checked concurrently; output order matches input order.

type LocalDigestFunc

type LocalDigestFunc func(ctx context.Context, stackKey, service, imageRef string) (string, error)

LocalDigestFunc returns the local digest for an image reference on the Docker daemon associated with the given stack and service. Implementations should prefer the digest of the running container (so that a pulled-but-not-recreated container still appears stale), falling back to the stored image digest when no container is running. This is injected to avoid coupling to the docker CLI directly.

type ServiceSpec

type ServiceSpec struct {
	Image      string
	TagPattern string
}

ServiceSpec holds the image reference and optional tag pattern for a single service within a stack. The tag pattern is read from the service's `dockform.tag_pattern` compose label; empty means digest-only.

Jump to

Keyboard shortcuts

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