Documentation ¶
Index ¶
- Constants
- Variables
- func BinaryURL(build *Build) (*url.URL, error)
- func DownloadBinary(build *Build, asProd bool) (string, error)
- func DownloadRoot() string
- func FindEmpiricaDir() (string, string, error)
- func FindReleaseFilePath() (string, string, error)
- func LookupBinary() (string, error)
- func ReleaseFilePath() string
- func SaveReleaseFile(dir string) error
- func SaveReleaseFileVersion(dir string, build *Build) error
- func Version() string
- func VersionString() string
- type Build
- type VersionComponent
Constants ¶
const ( BuildSelectionEnvVar = "EMPIRICA_BUILD" DebugBuildEnvVar = "EMPIRICA_DEBUG_BUILD" DownloadRootEnvVar = "EMPIRICA_DOWNLOAD_ROOT" BinaryDirName = "binaries" )
Variables ¶
var ( ErrBuildMissing = errors.New("build info missing") ErrBuildEmpty = errors.New("build info empty") ErrEmpiricaDirNotFound = errors.New("empirica dir not found") )
var Branch string
Branch holds the git branch of the build.
var BuildNum string
BuildNum holds the build build (123).
var DevBuild string
DevBuild is "true" if this is a development build.
var ErrBuildNotFound = errors.New("build version not found")
var ErrEmptyBuild = errors.New("empty build")
var SHA string
SHA holds the build Git commit SHA1.
var Tag string
Tag holds the git tag of the build.
var Time string
Time holds the build time.
Functions ¶
func DownloadRoot ¶
func DownloadRoot() string
func FindEmpiricaDir ¶ added in v1.3.3
func FindReleaseFilePath ¶ added in v1.3.3
func LookupBinary ¶
func ReleaseFilePath ¶
func ReleaseFilePath() string
func SaveReleaseFile ¶
func SaveReleaseFileVersion ¶
func Version ¶
func Version() string
Version return the build version (vX.Y.Z) at build time. Returns "" if this build was not a tagged version.
func VersionString ¶
func VersionString() string
Types ¶
type Build ¶
type Build struct { DevBuild string `json:"dev,omitempty" yaml:"dev,omitempty"` Version string `json:"version,omitempty" yaml:"version,omitempty"` SHA string `json:"sha,omitempty" yaml:"sha,omitempty"` BuildNum string `json:"build,omitempty" yaml:"build,omitempty"` Tag string `json:"tag,omitempty" yaml:"tag,omitempty"` Branch string `json:"branch,omitempty" yaml:"branch,omitempty"` Time string `json:"time,omitempty" yaml:"time,omitempty"` // contains filtered or unexported fields }
func BinaryVersion ¶
BinaryVersion returns which binary version should be used. It will first use the environement variable override, then try to look for the version lock file inside a project.
func GetBinaryBuild ¶
func GetProjectRelease ¶ added in v1.3.3
Return project build and root path, or and error if we're not in a project or we could not parse the release file.
func NewDevBuild ¶
func NewDevBuild() *Build
func NewProdBuild ¶
func NewProdBuild() *Build
func (*Build) PathComponents ¶
PathComponents returns all paths components (x/y/z) for this version: E.g. "version/v1.2.3", "sha/abcdefg", "build/123", "tag/v1.2.3", "branch/master".
func (*Build) PreferedPathComponent ¶
PreferedPathComponent returns the path component (x/y/z) that best identify this version, with the following precedence: - version - sha - build - tag - branch E.g. If version == "v1.2.3", then the path components are "version/v1.2.3".