versioning

package
v0.4.9 Latest Latest
Warning

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

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

Documentation

Overview

Package versioning resolves the release identifier (immutable version + image ref) for each service that c2quay is about to gate.

c2quay intentionally refuses mutable identifiers. Only `manifest_file`, `resolved_image_digest`, and `git_sha` are supported. `image_tag` was considered and rejected — see docs/adr/0001-immutable-release-identity.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseShortOption added in v0.4.5

func ParseShortOption(raw string) (int, bool, error)

ParseShortOption interprets the raw value of versioning.options.short from YAML (which is always a string in the map[string]string model). It accepts common boolean spellings and positive integers.

Returns (short, recognized, error):

""                      → (0, false, nil)   // absent, caller uses default
"false"/"0"/"no"        → (0, true, nil)    // explicit off
"true"/"yes"            → (-1, true, nil)   // use git default abbreviation
"N" where N in [1..40]  → (N, true, nil)    // explicit length
anything else           → error

Types

type GitSHA

type GitSHA struct {
	// contains filtered or unexported fields
}

func NewGitSHA

func NewGitSHA() *GitSHA

func NewGitSHAWith added in v0.4.5

func NewGitSHAWith(opts GitSHAOptions) *GitSHA

NewGitSHAWith constructs a GitSHA strategy with explicit options. Used by the Factory when the config asks for an abbreviated SHA.

func (*GitSHA) Name

func (*GitSHA) Name() string

func (*GitSHA) Resolve

func (g *GitSHA) Resolve(ctx context.Context, services []string) (map[string]Release, error)

type GitSHAOptions added in v0.4.5

type GitSHAOptions struct {
	// Short asks git for an abbreviated SHA. 0 means full; values > 0 pin an
	// explicit length (passed as `--short=N`); -1 means "use git's default
	// abbreviation" (honours core.abbrev, usually 7).
	Short int
}

GitSHAOptions tunes the git_sha strategy. Zero value = full 40-char SHA, which preserves pre-v0.4.5 behaviour.

type ManifestFile

type ManifestFile struct {
	// contains filtered or unexported fields
}

func NewManifestFile

func NewManifestFile(path string) *ManifestFile

func (*ManifestFile) Name

func (*ManifestFile) Name() string

func (*ManifestFile) Resolve

func (m *ManifestFile) Resolve(_ context.Context, services []string) (map[string]Release, error)

type Release

type Release struct {
	Version  string // immutable identifier (SHA, digest, or manifest-provided version)
	ImageRef string // optional — the resolved image reference if known
}

Release is the resolved identity of a service for a given deploy.

type ResolvedDigest

type ResolvedDigest struct {
	// contains filtered or unexported fields
}

ResolvedDigest resolves each service's release identifier as the sha256 digest embedded in its Compose image reference.

func NewResolvedDigest

func NewResolvedDigest(a configRenderer) *ResolvedDigest

NewResolvedDigest builds a ResolvedDigest strategy backed by a Compose adapter (or anything that renders a compose config JSON).

func (*ResolvedDigest) Name

func (*ResolvedDigest) Name() string

func (*ResolvedDigest) Resolve

func (r *ResolvedDigest) Resolve(ctx context.Context, services []string) (map[string]Release, error)

type Strategy

type Strategy interface {
	Name() string
	Resolve(ctx context.Context, services []string) (map[string]Release, error)
}

Strategy resolves release identifiers for a set of services.

func Factory

func Factory(cfg *config.Config, adapter configRenderer) (Strategy, error)

Factory builds the Strategy for a given config. The adapter is only used by the resolved_image_digest strategy; other strategies ignore it.

Jump to

Keyboard shortcuts

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