Documentation
¶
Overview ¶
Package imageupdate detects when a newer image is available for a PULL-IMAGE app service (a service that runs `image: postgres:16` rather than a git build). It is the image-side analog of the git poller's "update available": the git poller tells you a connected repo has new commits to deploy; this tells you a pinned image tag now resolves to a newer digest in its registry, so a redeploy would pull it. Like the git poller it is ADVISORY only — Mooring never auto-pulls (it never auto-deploys); it surfaces the update and, optionally, alerts.
Feasibility note: the registry digest is NOT reachable over Mooring's read plane (the socket-proxy denies IMAGES + DISTRIBUTION on purpose), so the check runs on the write-plane `docker` CLI — the same binary that deploys — using metadata-only commands (no layer pull).
Index ¶
- type Row
- type Runner
- type Store
- func (s *Store) Delete(ctx context.Context, project string) error
- func (s *Store) Get(ctx context.Context, project, service string) (Row, bool, error)
- func (s *Store) List(ctx context.Context) ([]Row, error)
- func (s *Store) PruneExcept(ctx context.Context, keep map[string]map[string]bool) error
- func (s *Store) Save(ctx context.Context, r Row) error
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Row ¶
type Row struct {
Project string
Service string
ImageRef string
DeployedDigest string
LatestDigest string
UpdateAvailable bool
CheckedAt int64
Error string
}
Row is one service's image-update state.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner periodically resolves each pull-image service's local vs registry digest, stores the result, and alerts once per newly-available digest. It is modeled on imagescan.Runner (boot delay → ticker) but does NOT gate on dashboard activity: the operator wants to be told an update is available even with the tab closed, like vulnerability scanning.
func NewRunner ¶
func NewRunner(exec digestExec, store *Store, alerts alertSink, targets func(context.Context) []Target, interval time.Duration, log *slog.Logger) *Runner
NewRunner builds a Runner. interval floors at 1h in Run.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists the latest per-service image-update state (current state, no history).
func (*Store) List ¶
List returns every service's state, updates-available first then by app/service. It selects all columns in ONE query and never issues a per-row nested query while the rows are open (the single-conn SQLite self-deadlock rule).
func (*Store) PruneExcept ¶
PruneExcept removes rows for services that no longer exist in the live set (an app dropped a pull-image service, or switched it to a build). keep maps project → set of live service names. It reads all (project, service) keys in one query, then deletes the stale ones after the rows are closed — never a nested query while iterating (the single-conn rule).