Help us shape the future of Go! Take the 2026 Go Developer Survey

imageupdate

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Core labels
	LabelArcane      = "com.getarcaneapp.arcane"         // Identifies the Arcane container itself
	LabelArcaneAgent = "com.getarcaneapp.arcane.agent"   // Identifies an Arcane agent container
	LabelUpdater     = "com.getarcaneapp.arcane.updater" // Enable/disable updates (true/false)

	// Dependency labels
	LabelDependsOn  = "com.getarcaneapp.arcane.depends-on"  // Comma-separated list of container names this depends on
	LabelStopSignal = "com.getarcaneapp.arcane.stop-signal" // Custom stop signal (e.g., SIGINT)
)

Variables

This section is empty.

Functions

func DigestFromReferenceSuffix

func DigestFromReferenceSuffix(ref string) (string, bool)

func ExtractContainerName

func ExtractContainerName(cnt container.Summary) string

ExtractContainerName extracts a clean container name from the summary

func FetchDigest

func FetchDigest(ctx context.Context, registryHost, repository, tag string, credential *Credentials, httpClient *http.Client) (string, error)

func GetStopSignal

func GetStopSignal(labels map[string]string) string

GetStopSignal returns the custom stop signal if set, otherwise empty string

func IsArcaneAgentContainer

func IsArcaneAgentContainer(labels map[string]string) bool

IsArcaneAgentContainer checks if the container is an Arcane agent container.

func IsArcaneContainer

func IsArcaneContainer(labels map[string]string) bool

IsArcaneContainer checks if the container is the Arcane application itself

func IsArcaneServerContainer

func IsArcaneServerContainer(labels map[string]string) bool

IsArcaneServerContainer checks if the container is the Arcane server, excluding agents.

func IsFallbackEligibleDaemonError

func IsFallbackEligibleDaemonError(err error) bool

func IsUpdateDisabled

func IsUpdateDisabled(labels map[string]string) bool

IsUpdateDisabled returns true if the special label is present and evaluates to false. Accepts false/0/no/off (case-insensitive) as "disabled". Default is enabled.

func NewRegistryHTTPClient

func NewRegistryHTTPClient() *http.Client

NewRegistryHTTPClient returns the shared transport configuration used for direct registry digest lookups.

func NormalizeDigest

func NormalizeDigest(value string) (string, error)

func SetupMessageOnlyLogFile

func SetupMessageOnlyLogFile(dataDir string, filePrefix string, minLevel slog.Level) (*os.File, error)

SetupMessageOnlyLogFile configures slog to write structured logs to stdout and a message-only format to a file under dataDir.

The file format is: <msg> key=value key=value ... (no time/level/source) to keep upgrade logs concise for end users.

func ShouldDisableArcaneServerRedeploy

func ShouldDisableArcaneServerRedeploy(labels map[string]string, containerID, currentContainerID string, currentErr error) bool

ShouldDisableArcaneServerRedeploy reports whether redeploy should be blocked for the given container.

func UpdateImplicitRestart

func UpdateImplicitRestart(containers []ContainerWithDeps, markedForRestart map[string]bool) []string

UpdateImplicitRestart marks containers that need to restart because their dependencies are restarting. Returns the names of containers that were marked for implicit restart. Note: This function mutates the containers slice by adding "_arcane_implicit_restart" labels.

Types

type CheckResult

type CheckResult struct {
	NeedsUpdate   bool
	LocalDigest   string
	RemoteDigest  string
	Error         error
	CheckedViaAPI bool // True if we checked via registry API, false if we had to pull
}

CheckResult contains the result of a digest check

type ContainerSorter

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

ContainerSorter handles topological sorting of containers based on dependencies

func NewContainerSorter

func NewContainerSorter(containers []ContainerWithDeps) *ContainerSorter

NewContainerSorter creates a new sorter for the given containers

func (*ContainerSorter) Sort

func (s *ContainerSorter) Sort() ([]ContainerWithDeps, error)

Sort performs topological sort and returns containers in dependency order Dependencies come first, dependents come later

func (*ContainerSorter) SortReverse

func (s *ContainerSorter) SortReverse() ([]ContainerWithDeps, error)

SortReverse returns containers in reverse dependency order Dependents come first, dependencies come later (for stopping)

type ContainerWithDeps

type ContainerWithDeps struct {
	Container   container.Summary
	Inspect     container.InspectResponse
	Name        string
	Links       []string // Container names this one links to
	DependsOn   []string // Explicit dependencies from label
	NetworkDeps []string // Implicit dependencies from container network mode
}

ContainerWithDeps represents a container with its dependency information for sorting

func ExtractContainerDeps

func ExtractContainerDeps(ctx context.Context, dcli *client.Client, cnt container.Summary, inspect container.InspectResponse) ContainerWithDeps

ExtractContainerDeps extracts dependency information from a container

type Credentials

type Credentials struct {
	Username string
	Token    string
}

type DigestChecker

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

DigestChecker provides methods to check if an image needs updating by comparing digests

func NewDigestChecker

func NewDigestChecker(dcli *client.Client, digestResolver remoteDigestResolver) *DigestChecker

NewDigestChecker creates a new DigestChecker

func (*DigestChecker) CheckImageNeedsUpdate

func (c *DigestChecker) CheckImageNeedsUpdate(ctx context.Context, imageRef string) CheckResult

CheckImageNeedsUpdate checks if an image has a newer version available without pulling Returns true if the remote digest differs from the local digest

func (*DigestChecker) CompareWithPulled

func (c *DigestChecker) CompareWithPulled(ctx context.Context, containerImageID string, newImageRef string) (bool, error)

CompareWithPulled compares the current container's image with a freshly pulled image This is the fallback when HEAD request doesn't work

func (*DigestChecker) GetImageIDsForRef

func (c *DigestChecker) GetImageIDsForRef(ctx context.Context, ref string) ([]string, error)

GetImageIDsForRef returns the image IDs associated with a reference

type RateLimitInfo

type RateLimitInfo struct {
	Limit         *int   `json:"limit,omitempty"`
	Remaining     *int   `json:"remaining,omitempty"`
	Used          *int   `json:"used,omitempty"`
	WindowSeconds *int   `json:"windowSeconds,omitempty"`
	Source        string `json:"source,omitempty"`
}

RateLimitInfo contains pull quota information returned by registry headers.

func FetchRegistryRateLimit

func FetchRegistryRateLimit(ctx context.Context, registryHost, repository, tag string, credential *Credentials, httpClient *http.Client) (*RateLimitInfo, error)

FetchRegistryRateLimit fetches pull rate limit information from an OCI registry manifest response.

type Reference

type Reference struct {
	NormalizedRef string
	RegistryHost  string
	Repository    string
	Tag           string
}

func NormalizeReference

func NormalizeReference(imageRef string) (*Reference, error)

Jump to

Keyboard shortcuts

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