-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
50 lines (38 loc) · 860 Bytes
/
main.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
47
48
49
50
package main
import (
"context"
"os"
log "github.com/sirupsen/logrus"
"github.com/philips-software/gino-keva/internal/git"
)
const (
envPrefix = "GINO_KEVA"
)
func checkIfError(err error) {
if err != nil {
log.Fatal(err)
}
}
func main() {
log.SetOutput(os.Stderr)
attemptsLeft := maxRetryAttempts
var err error
for {
root := NewRootCommand()
root.SilenceUsage = true
root.SilenceErrors = true
ctx := ContextWithGitWrapper(context.Background(), &git.GoGitCmdWrapper{})
err = root.ExecuteContext(ctx)
attemptsLeft--
uc, upstreamChanged := err.(*UpstreamChanged)
if attemptsLeft > 0 && upstreamChanged && uc.fetchEnabled {
log.WithField("attemptsLeft", attemptsLeft).Info("Upstream has changed in the meanwhile. Starting again from fetch")
} else {
break
}
}
if err != nil {
log.Fatal(err)
os.Exit(1)
}
}