version

package
v0.0.0-...-aa25bfb Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureSemver

func EnsureSemver(current string) (string, error)

EnsureSemver adds the 'v' prefix if needed and ensures the provided version is semver-compliant.

func ValidVersionChange

func ValidVersionChange(ctx context.Context, current, next string) bool

ValidVersionChange receives the current version and the candidate next version and evaluates if the version transition is valid.

Types

type BasicHTTPVersionGetter

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

BasicHTTPVersionGetter gets the version from an HTTP response containing only the version. This is used typically to get version from a file hosted in a s3 bucket or raw file served over HTTP. BasicHTTPVersionGetter uses basicHTTPVersionClient and wraps it in a cache in order to mitigate the impact of too frequent reconciliations. The structure implements the version.Getter interface.

func (BasicHTTPVersionGetter) GetVersion

func (g BasicHTTPVersionGetter) GetVersion(ctx context.Context) (string, error)

type Getter

type Getter interface {
	GetVersion(context.Context) (string, error)
}

Getter gets the target image version for an external source. It should cache the result to reduce io and avoid potential rate-limits and is safe to call multiple times over a short period.

func NewBasicHTTPVersionGetter

func NewBasicHTTPVersionGetter(baseURL *url.URL) Getter

func NewGetterMock

func NewGetterMock(version string, err error) Getter

NewGetterMock creates a GetterMock

type GetterMock

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

GetterMock is a fake version.Getter that return a static answer. This is used for testing purposes.

func (GetterMock) GetVersion

func (v GetterMock) GetVersion(_ context.Context) (string, error)

GetVersion returns the statically defined version.

Jump to

Keyboard shortcuts

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