forked from joeholley/supergloo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.go
46 lines (40 loc) · 1.39 KB
/
check.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
44
45
46
package version
import (
"github.com/pkg/errors"
"github.com/solo-io/go-utils/log"
version "github.com/solo-io/go-utils/versionutils"
)
func CheckVersions() error {
log.Printf("Checking expected solo kit and gloo versions...")
tomlTree, err := version.ParseToml()
if err != nil {
return err
}
expectedGlooVersion, err := version.GetVersion(version.GlooPkg, tomlTree)
if err != nil {
return err
}
expectedSoloKitVersion, err := version.GetVersion(version.SoloKitPkg, tomlTree)
if err != nil {
return err
}
log.Printf("Checking repo versions...")
actualGlooVersion, err := version.GetGitVersion("../gloo")
if err != nil {
return err
}
expectedTaggedGlooVersion := version.GetTag(expectedGlooVersion)
if expectedTaggedGlooVersion != actualGlooVersion {
return errors.Errorf("Expected gloo version %s, found gloo version %s in repo. Run 'make pin-repos' or fix manually.", expectedTaggedGlooVersion, actualGlooVersion)
}
actualSoloKitVersion, err := version.GetGitVersion("../solo-kit")
if err != nil {
return err
}
expectedTaggedSoloKitVersion := version.GetTag(expectedSoloKitVersion)
if expectedTaggedSoloKitVersion != actualSoloKitVersion {
return errors.Errorf("Expected solo kit version %s, found solo kit version %s in repo. Run 'make pin-repos' or fix manually.", expectedTaggedSoloKitVersion, actualSoloKitVersion)
}
log.Printf("Versions are pinned correctly.")
return nil
}