Documentation ¶
Index ¶
- Constants
- Variables
- func GetDependencyVersionInfo(pkgName string, toml *TomlWrapper) (*dep.VersionInfo, error)
- func GetGitVersion(relativeRepoDir string) (string, error)deprecated
- func GetImageVersion(version *Version) string
- func GetTag(version string) stringdeprecated
- func GetTomlVersion(pkgName string, toml *TomlWrapper) (string, error)deprecated
- func GetVersion(pkgName string, tomlTree []*toml.Tree) (string, error)deprecated
- func GetVersionFromTag(shouldBeAVersion string) (string, error)
- func Index(versions []Version, v Version) int
- func IndexPtr(versions []*Version, v Version) int
- func IsGreaterThanTag(greaterTag, lesserTag string) (bool, bool, error)
- func IsGreaterThanTagWithLabelOrder(greaterTag, lesserTag string, labelOrder []string) (bool, bool, error)
- func MatchesRegex(tag string) bool
- func ParseToml() ([]*toml.Tree, error)deprecated
- func ParseTomlFromDir(relativeDir string) ([]*toml.Tree, error)deprecated
- func ParseTomlOverrides() ([]*toml.Tree, error)deprecated
- func ParseTomlOverridesFromDir(relativeDir string) ([]*toml.Tree, error)deprecated
- func PinGitVersion(relativeRepoDir string, semVerVersion string) errordeprecated
- type TomlWrapper
- type Version
- func (v *Version) Equals(other *Version) bool
- func (v *Version) IncrementVersion(breakingChange, newFeature bool) *Version
- func (v Version) IsGreaterThan(lesser Version) (bool, bool)
- func (v Version) IsGreaterThanOrEqualTo(lesser Version) (bool, bool)
- func (v *Version) IsGreaterThanOrEqualToPtr(lesser *Version) (bool, bool, error)
- func (v *Version) IsGreaterThanPtr(lesser *Version) (bool, bool, error)
- func (v Version) IsGreaterThanWithLabelOrder(lesser Version, labelOrder []string) (bool, bool)
- func (v *Version) MarshalJSON() ([]byte, error)
- func (v Version) MustIsGreaterThan(lesser Version) bool
- func (v Version) MustIsGreaterThanOrEqualTo(lesser Version) bool
- func (v *Version) String() string
Constants ¶
const ( SemverNilVersionValue = "v0.0.0" SemverMinimumVersion = "v0.0.1" )
SemverLowerBound is the "nil" value for changelog versions It is not itself a valid version but it allows us to use our semver validation on the v0.0.1 edge case
Variables ¶
var ( UnableToFindVersionInTomlError = func(pkgName string) error { return fmt.Errorf("unable to find version for %s in toml", pkgName) } FailedCommandError = func(err error, args []string, output string) error { return errors.Wrapf(err, "%v failed: %s", args, output) } )
var ( InvalidSemverVersionError = func(tag string) error { return eris.Errorf("Tag %s is not a valid semver version, must be of the form vX.Y.Z[-<label>#]", tag) } )
Functions ¶
func GetDependencyVersionInfo ¶ added in v0.10.8
func GetDependencyVersionInfo(pkgName string, toml *TomlWrapper) (*dep.VersionInfo, error)
Returns the version of the given package together with the type of version identifier, i.e. revision, version, branch.
func GetGitVersion
deprecated
func GetImageVersion ¶ added in v0.9.7
func GetTomlVersion
deprecated
func GetTomlVersion(pkgName string, toml *TomlWrapper) (string, error)
Deprecated: use GetDependencyVersionInfo
func GetVersion
deprecated
func GetVersionFromTag ¶
func IsGreaterThanTagWithLabelOrder ¶ added in v0.21.2
func MatchesRegex ¶
func ParseTomlFromDir
deprecated
func ParseTomlOverrides
deprecated
func ParseTomlOverrides() ([]*toml.Tree, error)
Deprecated: Use ParseFullToml instead
func ParseTomlOverridesFromDir
deprecated
func PinGitVersion
deprecated
Types ¶
type TomlWrapper ¶
type TomlWrapper struct { Overrides []*toml.Tree Constraints []*toml.Tree }
func ParseFullToml ¶
func ParseFullToml() (*TomlWrapper, error)
func ParseFullTomlFromDir ¶
func ParseFullTomlFromDir(relativeDir string) (*TomlWrapper, error)
type Version ¶
type Version struct { Major int Minor int Patch int // optional to support a version like "1.0.0-rc1", where "rc" is the label and "1" is the label version // for comparisons: // - "1.0.0-rc1" is greater than "0.X.Y" and less than "1.0.0" // - "1.0.0-rc5" is greater than "1.0.0-rc1" // - "1.0.0-aX" is not greater than or less than "1.0.0-bY", except by convention Label string LabelVersion int }
func GetReleaseVersionOrExitGracefully ¶
func GetReleaseVersionOrExitGracefully() *Version
func ParseVersion ¶
func StableApiVersion ¶
func StableApiVersion() Version
func (*Version) IncrementVersion ¶
func (Version) IsGreaterThan ¶
In order, returns isGreaterThanOrEqualTo, isDeterminable isDeterminable is for incomparable versions because they have different labels, e.g. 1.0.0-foo1 vs 1.0.0-bar2 If you want to tiebreak indeterminate comparisons using alphanumeric ordering, try MustIsGreaterThan
func (Version) IsGreaterThanOrEqualTo ¶
In order, returns isGreaterThanOrEqualTo, isDeterminable isDeterminable is for incomparable versions because they have different labels, e.g. 1.0.0-foo1 vs 1.0.0-bar2 If you want to tiebreak indeterminate comparisons using alphanumeric ordering, try MustIsGreaterThanOrEqualTo
func (*Version) IsGreaterThanOrEqualToPtr ¶ added in v0.12.0
In order, returns isGreaterThanOrEqualTo, isDeterminable, err isDeterminable is for incomparable versions because they have different labels, e.g. 1.0.0-foo1 vs 1.0.0-bar2 If you want to tiebreak indeterminate comparisons using alphanumeric ordering, try MustIsGreaterThanOrEqualTo
func (*Version) IsGreaterThanPtr ¶ added in v0.12.0
In order, returns isGreaterThanOrEqualTo, isDeterminable, err isDeterminable is for incomparable versions because they have different labels, e.g. 1.0.0-foo1 vs 1.0.0-bar2 If you want to tiebreak indeterminate comparisons using alphanumeric ordering, try MustIsGreaterThan
func (Version) IsGreaterThanWithLabelOrder ¶ added in v0.21.2
In order, returns isGreaterThanOrEqualTo, isDeterminable labelOrder specifies tie-break order for labels e.g. labelOrder = [ beta, alpha, predev ], then 1.7.0-beta11 > 1.7.0-alpha5 > 1.7.0-predev9 isDeterminable is for incomporable versions because they have different labels not specified in labelOrder
func (*Version) MarshalJSON ¶ added in v0.21.7
func (Version) MustIsGreaterThan ¶ added in v0.12.0
for incomparable versions, default to alphanumeric sort on label e.g. 1.0.0-foo1 > 1.0.0-bar2
func (Version) MustIsGreaterThanOrEqualTo ¶ added in v0.12.0
for incomparable versions, default to alphanumeric sort on label e.g. 1.0.0-foo1 > 1.0.0-bar2