promotion

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 5 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 promotion answers "is the fix in prod yet".

One row per app, one column per environment, sorted so the apps whose environments disagree float to the top. The matrix compares and never promotes: no control here mutates anything, because deploying belongs to the pipeline that owns it.

Two distinctions carry most of the value. Ahead is worse than behind: behind is a schedule, ahead is an out-of-band change. And absent is not forbidden: "it is not deployed there" and "I cannot see it" are different facts, and a matrix that renders them the same way is a matrix that lies during an incident.

Index

Constants

View Source
const (
	StateSame          = "same"
	StateBehind        = "behind"
	StateAhead         = "ahead"
	StateDiffers       = "differs"
	StateDigestDiffers = "digest-differs"
	StateAbsent        = "absent"
	StateDenied        = "denied"
	// StateSplit is an environment whose clusters do not agree. It never
	// carries a version, because picking one would be the guess this state
	// exists to prevent.
	StateSplit = "split"
)

Cell states.

Variables

This section is empty.

Functions

func CompareTags added in v1.2.0

func CompareTags(a, b string) int

CompareTags orders two version tags, returning zero when they cannot be ordered. Claiming a direction we cannot establish would be worse than saying they merely differ.

func Identity added in v1.2.0

func Identity(app, namespace string) string

Identity is how one app is recognized across environments.

Name plus namespace, with an environment suffix or prefix tolerated, because team-a-qa and team-a-prod are one team's namespace in two places and lining those up is the whole point of the view.

func Orderable added in v1.2.0

func Orderable(tag string) bool

Orderable reports whether a tag can take part in an ordering at all.

CompareTags returns zero both for two tags that are equal and for a pair it refuses to order, so zero alone cannot tell those apart. A caller picking a maximum needs the difference: an unorderable tag that wins the maximum by never losing would become a yardstick nothing can be measured against.

func StripEnvToken added in v1.2.0

func StripEnvToken(ns string) string

StripEnvToken removes the environment token from a namespace, so that team-a-qa and team-a-prod resolve to one identity.

func TagOf

func TagOf(image string) string

TagOf reads the tag from an image reference.

A registry port is not a tag: reading "registry:5000/app" as tag 5000 would put a port number in every cell of a self-hosted registry's matrix.

Types

type Cell

type Cell struct {
	Env       string `json:"env"`
	Namespace string `json:"namespace,omitempty"`
	State     string `json:"state"`
	Tag       string `json:"tag,omitempty"`
	Image     string `json:"image,omitempty"`
	Digest    string `json:"digest,omitempty"`
	// DigestPending marks a cell whose digest has not arrived. Tag comparison
	// never waits for it, and a missing digest never reads as a match.
	DigestPending bool   `json:"digestPending,omitempty"`
	Health        string `json:"health,omitempty"`
	Ready         string `json:"ready,omitempty"`
	RevisionAt    string `json:"revisionAt,omitempty"`
	Note          string `json:"note,omitempty"`
	// Severe marks the states that deserve the error hue rather than a warning:
	// ahead of upstream, and a tag that resolves to a different digest.
	Severe bool `json:"severe,omitempty"`
	// Clusters is how many contexts back this cell. Zero and one both mean a
	// single cluster; the UI shows the count only above one.
	Clusters int `json:"clusters,omitempty"`
}

Cell is one instance, compared against its upstream.

type Env

type Env struct {
	Name string `json:"name"`
	Risk string `json:"risk"`
	// Context is the first context bound to this environment, kept so a cell
	// can still be opened. Contexts is all of them.
	Context  string   `json:"context,omitempty"`
	Contexts []string `json:"contexts,omitempty"`
	// Unreadable names the contexts that did not answer. A cell in an
	// environment with any unreadable context can never claim agreement,
	// because the clusters nobody read might disagree.
	Unreadable []string `json:"unreadable,omitempty"`
}

Env is one column.

type Instance

type Instance struct {
	Env       string
	Context   string
	App       string
	Namespace string

	Present bool
	// Denied marks an environment that could not be read. It is deliberately
	// not the same as absent.
	Denied       bool
	DeniedReason string

	Image  string
	Tag    string
	Digest string

	Health     string
	Ready      string
	RevisionAt string
}

Instance is one app as it exists in one environment.

type Row

type Row struct {
	App       string `json:"app"`
	Namespace string `json:"namespace"`
	Cells     []Cell `json:"cells"`
	Drift     int    `json:"drift"`
	Ahead     bool   `json:"ahead,omitempty"`
}

Row is one app across every environment.

func Build

func Build(envs []Env, instances []Instance) []Row

Build lays out the matrix.

type Summary

type Summary struct {
	Apps    int `json:"apps"`
	Drifted int `json:"drifted"`
	Ahead   int `json:"ahead"`
	Split   int `json:"split"`
}

Summary is what the page header reports.

func Summarize

func Summarize(rows []Row) Summary

Summarize counts the rows worth looking at.

Jump to

Keyboard shortcuts

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