versioncheck

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package versioncheck fetches upstream release metadata without changing inventory state.

Index

Constants

This section is empty.

Variables

View Source
var ErrRunning = errors.New("version check already running")

Functions

func Compare

func Compare(current, latest string) (int, bool)

Compare accepts only plain numeric releases. Unknown formats are never called outdated.

func SaveAlertSettings added in v0.3.0

func SaveAlertSettings(ctx context.Context, db *sql.DB, v AlertSettings) error

func State added in v0.3.0

func State(current, latest string, pinned, eol any, now time.Time) string

func ValidWebhookURL added in v0.3.0

func ValidWebhookURL(value string) bool

func ValidateConfig added in v0.3.0

func ValidateConfig(cfg Config) error

Types

type AlertSettings added in v0.3.0

type AlertSettings struct {
	Enabled    bool   `json:"enabled"`
	WebhookURL string `json:"webhook_url"`
	Format     string `json:"format"`
}

func GetAlertSettings added in v0.3.0

func GetAlertSettings(ctx context.Context, db *sql.DB) (AlertSettings, error)

type Checker

type Checker struct {
	DB                           *sql.DB
	Client                       *http.Client
	GitHubURL, DockerURL, EOLURL string // Test servers may replace the fixed public API origins.
	Now                          func() time.Time
}

func (Checker) DailyAlert added in v0.3.0

func (c Checker) DailyAlert(ctx context.Context) error

DailyAlert stores one global context per UTC day, then sends at most three attempts per day.

func (Checker) Run

func (c Checker) Run(ctx context.Context, dueOnly bool) (Summary, error)

Run checks all configured services, or only records older than 24 hours during scheduled runs.

func (Checker) Start

func (c Checker) Start(ctx context.Context)

Start checks stale services at startup and hourly thereafter. The context ends with the server.

type Config

type Config struct {
	Provider   string `json:"provider"`
	Repository string `json:"repository"`
	Image      string `json:"image"`
	Product    string `json:"product"`
	TagPrefix  string `json:"tag_prefix,omitempty"`
	TagRegex   string `json:"tag_regex,omitempty"`
}

type Result

type Result struct {
	ServiceID string `json:"service_id"`
	Status    string `json:"status"`
	Error     string `json:"error,omitempty"`
}

type Summary

type Summary struct {
	Checked int      `json:"checked"`
	Failed  int      `json:"failed"`
	Skipped int      `json:"skipped"`
	Results []Result `json:"results"`
}

Jump to

Keyboard shortcuts

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