version

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package version declares types for each string to keep strict coupling to the JSON schema

Index

Constants

This section is empty.

Variables

View Source
var LastKnownEnvoy = NewPatchVersion(lastKnownEnvoy)

LastKnownEnvoy is the last known Envoy PatchVersion, used to ensure help statements aren't out-of-date. This is derived from https://archive.tetratelabs.io/envoy/envoy-versions.json and validated in `make check`.

This is different from the "latestVersion" because this is built into the binary. For example, after the binary is built, a more recent "latestVersion" can be used, even if the help statements only know about the one from compile time.

View Source
var (
	// LastKnownEnvoyMinor is a convenience constant
	LastKnownEnvoyMinor = LastKnownEnvoy.ToMinor()
)

Functions

This section is empty.

Types

type GetReleaseVersions added in v1.1.0

type GetReleaseVersions func(ctx context.Context) (*ReleaseVersions, error)

GetReleaseVersions returns a version map from a remote URL. e.g. from globals.DefaultEnvoyVersionsURL

type MinorVersion added in v1.1.0

type MinorVersion string

MinorVersion is desired release from https://github.com/envoyproxy/envoy/blob/main/RELEASES.md, as a minor version. String will return a placeholder for the latest PatchVersion. Ex "1.18" or "1.20_debug"

func NewMinorVersion added in v1.1.0

func NewMinorVersion(input string) MinorVersion

NewMinorVersion returns a MinorVersion for a valid input like "1.19" or empty if invalid.

func (MinorVersion) String added in v1.1.0

func (v MinorVersion) String() string

String satisfies Version.String

func (MinorVersion) ToMinor added in v1.1.0

func (v MinorVersion) ToMinor() MinorVersion

ToMinor satisfies Version.ToMinor

type PatchVersion added in v1.1.0

type PatchVersion string

PatchVersion is a release version from https://github.com/envoyproxy/envoy/releases, without a 'v' prefix. This is the same form as "Version" in release-versions-schema.json. Ex "1.18.3" or "1.20.1_debug"

func FindLatestPatchVersion added in v1.1.0

func FindLatestPatchVersion(patchVersions []PatchVersion, minorVersion MinorVersion) PatchVersion

FindLatestPatchVersion finds the latest Patch version for the given minor version or empty if not found.

func FindLatestVersion added in v1.1.0

func FindLatestVersion(patchVersions []PatchVersion) PatchVersion

FindLatestVersion finds the latest non-debug version or empty if the input is.

func NewPatchVersion added in v1.1.0

func NewPatchVersion(input string) PatchVersion

NewPatchVersion returns a PatchVersion for a valid input like "1.19.1" or empty if invalid.

func (PatchVersion) Patch added in v1.1.0

func (v PatchVersion) Patch() int

Patch attempts to parse a Patch number from the Version.String. This will always succeed when created via NewVersion or NewPatchVersion

func (PatchVersion) String added in v1.1.0

func (v PatchVersion) String() string

String satisfies Version.String

func (PatchVersion) ToMinor added in v1.1.0

func (v PatchVersion) ToMinor() MinorVersion

ToMinor satisfies Version.ToMinor

type Platform

type Platform string

Platform encodes 'runtime.GOOS/runtime.GOARCH'. Ex "darwin/amd64"

type Release

type Release struct {
	ReleaseDate ReleaseDate

	// Tarballs are the Tarballs available by Platform
	Tarballs map[Platform]TarballURL `json:"tarballs,omitempty"`
}

Release primarily maps available Tarballs for a Version

type ReleaseDate

type ReleaseDate string

ReleaseDate is the publish date of the release Version. Ex. "2021-05-11"

type ReleaseVersions

type ReleaseVersions struct {
	// Versions maps a Version to its Release
	Versions map[PatchVersion]Release `json:"versions"`
	// SHA256Sums maps a Tarball to its SHA256Sum
	SHA256Sums map[Tarball]SHA256Sum `json:"sha256sums"`
}

ReleaseVersions primarily maps Version to TarballURL and tracks the LatestVersion

type SHA256Sum

type SHA256Sum string

SHA256Sum is a SHA-256 lower-hex hash. Ex. "1274f55b3022bc1331aed41089f189094e00729981fe132ce00aac6272ea0770"

type Tarball

type Tarball string

Tarball is the name of the tar.gz or tar.xz archive. Ex. "envoy-v1.18.3-linux-amd64.tar.xz" Minimum contents are "${dist}/bin/envoy[.exe]" Ex. "envoy-v1.18.3-linux-amd64/bin/envoy"

type TarballURL

type TarballURL string

TarballURL is the HTTPS URL to the Tarball. SHA256Sums must include its base name.

type Version

type Version interface {
	// String allows access to the underlying representation. Ex. "1.18", "1.18_debug", "1.19.3_debug"
	String() string
	// ToMinor returns a variant used to look up the latest Patch.
	ToMinor() MinorVersion
}

Version is a union type that allows commands to operate regardless of whether the input is a MinorVersion or a PatchVersion.

func NewVersion added in v1.1.0

func NewVersion(tag, input string) (Version, error)

NewVersion returns a valid input or an error

Jump to

Keyboard shortcuts

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