updater

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 28 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RedactURL added in v0.11.0

func RedactURL(raw string) string

func WithSource added in v0.12.0

func WithSource(ctx context.Context, s Source) context.Context

WithSource attaches s to ctx for inclusion in outgoing notifications.

Types

type ComposeProject

type ComposeProject struct {
	WorkingDir   string
	ConfigFiles  string
	ProjectName  string
	OnlySelf     bool
	SelfOutdated bool
}

type ComposeProjectLoader

type ComposeProjectLoader struct{}

func (ComposeProjectLoader) LoadProject

func (l ComposeProjectLoader) LoadProject(ctx context.Context, workingDir string, configFiles []string) (*composetypes.Project, error)

type ComposeUpRunner

type ComposeUpRunner interface {
	Up(ctx context.Context, project *composetypes.Project, options api.UpOptions) error
}

type ContainerInspector added in v0.15.0

type ContainerInspector interface {
	ContainerInspect(ctx context.Context, containerID string, options client.ContainerInspectOptions) (client.ContainerInspectResult, error)
}

type ContainerLister

type ContainerLister interface {
	ContainerList(ctx context.Context, opts client.ContainerListOptions) (client.ContainerListResult, error)
}

type ImageUpdater

type ImageUpdater interface {
	HandleUpdate(ctx context.Context, image string, tag string) error
}

func New

func New(ctx context.Context, dockerClient *client.Client, composeService ComposeUpRunner, notifier Notifier, includeOnly bool, opts ...Option) (ImageUpdater, error)

New returns a swarm updater if the docker daemon is a swarm manager, or a compose updater otherwise.

func NewFromEnv

func NewFromEnv(ctx context.Context, notifier Notifier, includeOnly bool, opts ...Option) (ImageUpdater, error)

NewFromEnv connects to docker using the standard environment variables and docker config, and returns a compose or swarm updater depending on how the daemon is configured.

type NoopNotifier

type NoopNotifier struct{}

func (NoopNotifier) NotifyPending

func (NoopNotifier) NotifyPending(_ context.Context, _ string, _ string, _ string)

func (NoopNotifier) NotifyResult

func (NoopNotifier) NotifyResult(_ context.Context, _ string, _ string, _ string, _ error)

func (NoopNotifier) NotifySkipped added in v0.15.0

func (NoopNotifier) NotifySkipped(_ context.Context, _ string, _ string, _ string, _ string)

type Notifier

type Notifier interface {
	NotifyPending(ctx context.Context, image string, target string, dir string)
	NotifyResult(ctx context.Context, image string, target string, dir string, err error)
	NotifySkipped(ctx context.Context, image string, target string, dir string, reason string)
}

type Option added in v0.14.0

type Option func(*options)

Option configures an updater.

func WithDirLocking added in v0.14.0

func WithDirLocking(enabled bool) Option

WithDirLocking sets whether a compose project's directory is flocked while it is updated. Defaults to false.

func WithSelf added in v0.15.0

func WithSelf(self Self) Option

type ProjectLoader

type ProjectLoader interface {
	LoadProject(ctx context.Context, workingDir string, configFiles []string) (*composetypes.Project, error)
}

type ProjectUpdateError

type ProjectUpdateError struct {
	Project string
	Err     error
}

func (*ProjectUpdateError) Error

func (e *ProjectUpdateError) Error() string

func (*ProjectUpdateError) Unwrap

func (e *ProjectUpdateError) Unwrap() error

type Self added in v0.15.0

type Self struct {
	Project string
	Service string
}

func DetectSelf added in v0.15.0

func DetectSelf(ctx context.Context, inspector ContainerInspector) (Self, bool)

type ServiceLister

type ServiceLister interface {
	ServiceList(ctx context.Context, options client.ServiceListOptions) (client.ServiceListResult, error)
}

type ServiceUpdateError

type ServiceUpdateError struct {
	ServiceName string
	ServiceID   string
	Err         error
}

func (*ServiceUpdateError) Error

func (e *ServiceUpdateError) Error() string

func (*ServiceUpdateError) Unwrap

func (e *ServiceUpdateError) Unwrap() error

type ServiceUpdater

type ServiceUpdater interface {
	ServiceUpdate(ctx context.Context, serviceID string, options client.ServiceUpdateOptions) (client.ServiceUpdateResult, error)
}

type Source added in v0.12.0

type Source struct {
	Owner   string
	Private bool
}

Source describes where the image that triggered an update came from.

type SwarmUpdater

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

func NewSwarmUpdater

func NewSwarmUpdater(serviceLister ServiceLister, serviceUpdater ServiceUpdater, notifier Notifier, includeOnly bool) *SwarmUpdater

func (*SwarmUpdater) HandleUpdate

func (u *SwarmUpdater) HandleUpdate(ctx context.Context, image string, tag string) error

type UpdateErrors

type UpdateErrors struct {
	Errors []error
}

func (*UpdateErrors) Error

func (e *UpdateErrors) Error() string

func (*UpdateErrors) Unwrap

func (e *UpdateErrors) Unwrap() []error

type Updater

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

func NewUpdater

func NewUpdater(composeService ComposeUpRunner, dockerClient ContainerLister, projectLoader ProjectLoader, notifier Notifier, includeOnly bool, opts ...Option) *Updater

func (*Updater) HandleUpdate

func (u *Updater) HandleUpdate(ctx context.Context, image string, tag string) error

type WebhookNotifier

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

func NewWebhookNotifier

func NewWebhookNotifier(url, secret string) *WebhookNotifier

func (*WebhookNotifier) NotifyPending

func (n *WebhookNotifier) NotifyPending(ctx context.Context, image string, target string, dir string)

func (*WebhookNotifier) NotifyResult

func (n *WebhookNotifier) NotifyResult(ctx context.Context, image string, target string, dir string, err error)

func (*WebhookNotifier) NotifySkipped added in v0.15.0

func (n *WebhookNotifier) NotifySkipped(ctx context.Context, image string, target string, dir string, reason string)

Jump to

Keyboard shortcuts

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