Documentation
¶
Overview ¶
Package resolver defines the datasource resolver registry for the Atmos Version Tracker. A resolver lists candidate versions for a package from a concrete datasource (GitHub tags/releases, OCI registries, the Atmos toolchain, ...) and can pin a version to an immutable digest.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrResolverUnsupported is returned when a datasource has no registered resolver. ErrResolverUnsupported = errors.New("version resolver unsupported") // ErrNoVersionMatch is returned when no candidate satisfies the desired expression. ErrNoVersionMatch = errors.New("no version satisfies constraint") // ErrPinUnsupported is returned when a datasource has no immutable digest concept. ErrPinUnsupported = errors.New("datasource does not support digest pinning") // ErrDuplicateResolver is returned when two resolvers register the same datasource name. ErrDuplicateResolver = errors.New("duplicate resolver registration") // ErrVersionListingUnsupported is returned when a datasource cannot enumerate versions. ErrVersionListingUnsupported = errors.New("datasource cannot list versions") )
Functions ¶
func AllowsVersion ¶
AllowsVersion reports whether one concrete version passes the include, exclude, and prerelease rules.
func LooksLikeConstraint ¶
LooksLikeConstraint reports whether a desired version uses constraint syntax rather than naming a concrete version.
Types ¶
type Candidate ¶
type Candidate struct {
// Version is the version string as published by the datasource.
Version string
// Digest is the immutable identifier for the version when known up front
// (git commit SHA for tags, sha256 digest for OCI images).
Digest string
// ReleasedAt is the upstream release timestamp when the datasource
// provides one; nil otherwise. Used for update cooldown checks.
ReleasedAt *time.Time
// Prerelease marks versions the datasource labels as prereleases.
Prerelease bool
}
Candidate is one version a datasource offers for a package.
func Select ¶
func Select(candidates []Candidate, desired string, include, exclude []string, prerelease bool) (Candidate, error)
Select returns the best candidate for the desired version expression after applying include, exclude, and prerelease rules. Desired takes one of three forms: "latest", a SemVer constraint (e.g. "~1.10", ">= 1.2, < 2"), or a concrete version (returned when present in the candidate list). Prerelease candidates are excluded unless prerelease is true. Include and exclude entries are glob or substring patterns matched against candidate versions.
type Request ¶
type Request struct {
// Package is the datasource-specific package coordinate (e.g. owner/repo).
Package string
// Datasource is the canonical datasource key (e.g. github-tags).
Datasource string
// Provider carries backend endpoint/auth configuration from version.providers.
Provider schema.VersionProvider
// Config is the Atmos configuration.
Config *schema.AtmosConfiguration
}
Request identifies the package a resolver operates on.
type Resolver ¶
type Resolver interface {
// Names returns the datasource names this resolver serves.
Names() []string
// Versions returns candidate versions for the requested package.
Versions(ctx context.Context, req *Request) ([]Candidate, error)
// Pin resolves a version to its immutable digest. Implementations return
// ErrPinUnsupported when the datasource has no digest concept.
Pin(ctx context.Context, req *Request, version string) (string, error)
}
Resolver lists and pins versions for one or more datasources.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package github implements the "github-tags" and "github-releases" datasource resolvers backed by the shared pkg/github client (token chain and rate-limit handling included).
|
Package github implements the "github-tags" and "github-releases" datasource resolvers backed by the shared pkg/github client (token chain and rate-limit handling included). |
|
Package oci implements the "oci-tags" and "docker-tags" datasource resolvers backed by go-containerregistry: tag listing for version discovery and manifest digests for immutable pinning.
|
Package oci implements the "oci-tags" and "docker-tags" datasource resolvers backed by go-containerregistry: tag listing for version discovery and manifest digests for immutable pinning. |
|
Package toolchain implements the "toolchain" datasource resolver backed by the Atmos toolchain's Aqua registry.
|
Package toolchain implements the "toolchain" datasource resolver backed by the Atmos toolchain's Aqua registry. |