Documentation
¶
Overview ¶
Package semverpick selects versions from candidate lists: the newest stable release satisfying a constraint (chart and artifact update checks), and the newest tag that has soaked past a cooldown window (tracked-image picks, where a just-published tag can still be yanked or hot-fixed).
Only release versions of the shape X.Y.Z — optionally v-prefixed — are ever considered; pre-releases and build metadata are filtered out before constraint evaluation, because the mirror only ships releases. All wall-clock input is injected, keeping the package deterministic under test.
Index ¶
- func CooldownPick(candidates []string, constraint string, cooldown time.Duration, now time.Time, ...) (string, error)
- func Newest(current string, candidates []string, constraint string) (string, bool, error)
- func Releases(candidates []string) []string
- func Satisfies(version, constraint string) (bool, error)
- type CreatedFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CooldownPick ¶
func CooldownPick(candidates []string, constraint string, cooldown time.Duration, now time.Time, created CreatedFunc, onSkip func(tag, reason string)) (string, error)
CooldownPick walks release candidates newest-first and returns the first tag published at least cooldown before now, so a release yanked or hot-fixed within its soak period is never the one the mirror adopts. Tags failing constraint are skipped without counting against the candidate cap; skipped-inside-cooldown tags are reported through onSkip (nil is fine). A cooldown of zero picks the newest satisfying tag.
func Newest ¶
Newest returns the newest release among candidates that satisfies constraint and is strictly newer than current, or ("", false) when the current pin is already the best available. Non-release candidates are skipped; current must itself parse as a version.