updatecheck

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 10 Imported by: 0 modules, 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

Overview

Package updatecheck tells a Beacon app whether a newer image of it has been published.

The same file lives in pilot, prism, haul and pulse (internal/updatecheck); change it in all four together.

Beacon images are published from main: every push that passes CI pushes ghcr.io/beacon-stack/<app>:latest, built with the commit as its version. So for a commit version, "newer" means: the latest successful CI run on main is a later commit than the one running. GitHub's compare API says how many commits behind, and which. A release-tag version (v1.2.3) is compared with the latest GitHub release instead, and a build with no version (a local "dev" build) says it can't tell.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker struct {
	Repo      string // "beacon-stack/prism"
	Workflow  string // the workflow that publishes images; default "ci.yml"
	Branch    string // default "main"
	UserAgent string // e.g. "Prism/<version>"
	Client    *http.Client
	BaseURL   string        // default "https://api.github.com"; tests override
	CacheFor  time.Duration // default 5 minutes; GitHub allows 60 unauthenticated calls an hour
	// contains filtered or unexported fields
}

Checker checks one repository.

func (*Checker) Check

func (c *Checker) Check(ctx context.Context, current string) (UpdateStatus, error)

Check compares current (the running build's version) with the newest published one. A result whose Message is set means it couldn't tell; errors are for GitHub being unreachable or refusing.

type UpdateCommit

type UpdateCommit struct {
	SHA     string `json:"sha"` // short
	Subject string `json:"subject"`
	URL     string `json:"url"`
}

UpdateCommit is one change in a newer build.

type UpdateStatus

type UpdateStatus struct {
	UpdateAvailable bool           `json:"update_available"`
	CurrentVersion  string         `json:"current_version"`
	LatestVersion   string         `json:"latest_version"`
	ReleaseURL      string         `json:"release_url,omitempty"`   // compare or release page
	ReleaseNotes    string         `json:"release_notes,omitempty"` // a release's notes (plain text)
	PublishedAt     string         `json:"published_at,omitempty"`  // when the newer build was published
	Behind          int            `json:"behind,omitempty"`        // commits behind, for commit versions
	Commits         []UpdateCommit `json:"commits,omitempty"`       // the newer commits, newest first
	Message         string         `json:"message,omitempty"`       // why it can't tell, when it can't
}

UpdateStatus is the response of GET /api/v1/system/updates.

Jump to

Keyboard shortcuts

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