precondition

package
v1.0.1-0...-8324378 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Summarize

func Summarize(errs []error, force bool) (bool, error)

Summarize summarizes all the precondition.Error from errs. Returns the consolidated error and a boolean for whether the error is blocking (true) or a warning (false).

Types

type Error

type Error struct {
	Nested             error
	Reason             string
	Message            string
	Name               string
	NonBlockingWarning bool // For some errors we do not want to fail the precondition check but we want to communicate about it
}

Error is a wrapper for errors that occur during a precondition check for payload.

func (*Error) Cause

func (e *Error) Cause() error

Cause returns the nested error.

func (*Error) Error

func (e *Error) Error() string

Error returns the message

type List

type List []Precondition

List is a list of precondition checks.

func (List) RunAll

func (pfList List) RunAll(ctx context.Context, releaseContext ReleaseContext) []error

RunAll runs all the reflight checks in order, returning a list of errors if any. All checks are run, regardless if any one precondition fails.

type Precondition

type Precondition interface {
	// Run executes the precondition checks ands returns an error when the precondition fails.
	Run(ctx context.Context, releaseContext ReleaseContext) error

	// Name returns a human friendly name of the precondition.
	Name() string
}

Precondition defines the precondition check for a payload.

type ReleaseContext

type ReleaseContext struct {
	// DesiredVersion is the version of the payload being considered.
	// While this might be a semantic version, consumers should not
	// require SemVer validity so they can handle custom releases
	// where the author decided to use a different naming scheme, or
	// to leave the version completely unset.
	DesiredVersion string
}

ReleaseContext holds information about the update being considered

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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