Documentation
¶
Overview ¶
Package release writes the shadow copy of ADR 050 release snapshots and environment bindings. Nothing here is read by a deploy decision.
Index ¶
- Constants
- func ImageRef(image, digest string) string
- func Install(db *store.DB, mode Mode, logger *slog.Logger)
- func OwnsRelease(ctx context.Context, b Binder, app string, rel *store.Release) bool
- func PromotionRelease(ctx context.Context, b Binder, source string, logger *slog.Logger) *store.Release
- func Retarget(ctx context.Context, b Binder, audit Auditor, logger *slog.Logger, ...) (func(), error)
- func RollbackReleaseID(ctx context.Context, b Binder, target store.DeployAttempt) string
- type Auditor
- type Binder
- type Config
- type Mode
- type Shadow
Constants ¶
const ( ReasonPromote = "promote" ReasonRollback = "rollback" ReasonRevert = "revert" ReasonDeploy = "deploy" )
Binding change reasons written to binding history.
const EnvBindings = "APP_RELEASE_BINDINGS"
EnvBindings selects the rollout mode: off (default), shadow or on.
Variables ¶
This section is empty.
Functions ¶
func OwnsRelease ¶
OwnsRelease reports whether rel may be applied to app: it was minted from app, or app's binding history has named it.
func PromotionRelease ¶
func PromotionRelease(ctx context.Context, b Binder, source string, logger *slog.Logger) *store.Release
PromotionRelease returns the release source is bound to, or nil when it has none (the tag path then applies, as the ADR's no-digest fallback).
func Retarget ¶
func Retarget(ctx context.Context, b Binder, audit Auditor, logger *slog.Logger, target store.DesiredService, releaseID, reason, by, approvalID string) (func(), error)
Retarget points target's binding at releaseID, audits the move and returns an undo for the caller to run if the deploy then fails, so the binding never names a release that did not run. The undo only applies while the binding still names releaseID, so a newer retarget is never reverted.
func RollbackReleaseID ¶
RollbackReleaseID finds the release a past attempt ran: the one minted from it, else a bound release of the app with the same digest pinned ref.
Types ¶
type Binder ¶
type Binder interface {
GetRelease(ctx context.Context, id string) (*store.Release, error)
GetReleaseByAttempt(ctx context.Context, attemptID string) (*store.Release, error)
GetEnvironmentBinding(ctx context.Context, app string) (*store.EnvironmentBinding, error)
ListBindingHistory(ctx context.Context, app string) ([]store.BindingHistoryEntry, error)
RetargetBinding(ctx context.Context, app, environmentID, releaseID, reason, by, approvalID string) (bool, error)
RetargetBindingIf(ctx context.Context, app, environmentID, releaseID, expected, reason, by, approvalID string) (bool, error)
UnbindRelease(ctx context.Context, app, expected, by string) (bool, error)
}
Binder is the store surface that makes bindings authoritative. It lives here so the API and the pipeline runner retarget through one code path.
type Config ¶
type Config struct {
Health *store.ServiceHealth `json:"health,omitempty"`
Replicas int `json:"replicas,omitempty"`
Strategy string `json:"strategy,omitempty"`
Resources *store.ServiceResources `json:"resources,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
Config is the environment neutral subset of a deploy snapshot. It holds no env values, domains, ports, volumes or placement.
type Mode ¶
type Mode string
Mode is the parsed APP_RELEASE_BINDINGS value.
Rollout modes. Only off, the default, leaves the store untouched.
func (Mode) Authoritative ¶
Authoritative reports whether promote and rollback decide through bindings.
type Shadow ¶
type Shadow struct {
// contains filtered or unexported fields
}
Shadow records releases and bindings next to the existing deploy path.