-
Notifications
You must be signed in to change notification settings - Fork 568
/
version.go
43 lines (37 loc) · 898 Bytes
/
version.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package version
import (
"fmt"
"os"
"go.pedge.io/proto/version"
)
const (
// MajorVersion is the current major version for pachyderm.
MajorVersion = 1
// MinorVersion is the current minor version for pachyderm.
MinorVersion = 0
// MicroVersion is the patch number for pachyderm.
MicroVersion = 1
)
var (
// Version is the current version for pachyderm.
Version = &protoversion.Version{
Major: MajorVersion,
Minor: MinorVersion,
Micro: MicroVersion,
Additional: getBuildNumber(),
}
)
func PrettyPrintVersion(version *protoversion.Version) string {
result := fmt.Sprintf("%d.%d.%d", version.Major, version.Minor, version.Micro)
if version.Additional != "" {
result += fmt.Sprintf("(%s)", version.Additional)
}
return result
}
func getBuildNumber() string {
value := os.Getenv("PACH_BUILD_NUMBER")
if value == "" {
value = "dirty"
}
return value
}