imageupdate

package
v0.18.5 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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

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.

func (*Runner) CheckAll

func (r *Runner) CheckAll(ctx context.Context)

CheckAll resolves every pull-image service once, sequentially (each digest read rides the one-docker-child slot via TryAcquire), then prunes rows for services that no longer exist.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context)

Run checks a few minutes after boot, then every interval, until ctx is done. Registry tags move slowly and Docker Hub rate-limits anonymous pulls, so the cadence is hours (default 24h), never the git poller's minutes.

type Store

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

Store persists the latest per-service image-update state (current state, no history).

func NewStore

func NewStore(db *store.DB) *Store

NewStore builds a Store over the shared single-conn DB.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, project string) error

Delete removes an app's rows (app teardown).

func (*Store) Get

func (s *Store) Get(ctx context.Context, project, service string) (Row, bool, error)

Get returns one service's state (ok=false if never checked).

func (*Store) List

func (s *Store) List(ctx context.Context) ([]Row, error)

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

func (s *Store) PruneExcept(ctx context.Context, keep map[string]map[string]bool) error

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).

func (*Store) Save

func (s *Store) Save(ctx context.Context, r Row) error

Save upserts one service's state.

type Target

type Target struct {
	Project string
	Service string
	Ref     string // the pinned image ref from mooring.yaml (e.g. "postgres:16")
}

Target is one pull-image service to check.

Jump to

Keyboard shortcuts

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