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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
package main
import (
"fmt"
"os"
"go.wit.com/log"
"go.wit.com/lib/cobol"
"go.wit.com/lib/protobuf/gitpb"
)
// trys to figure out if there is still something to update
// todo: redo this logic as it is terrible
// rename this findNext()
func findNext(found *gitpb.Repos) []*gitpb.Repo {
var trythese []*gitpb.Repo
// findCounter = 0
var simpletable [][]string
simpletable = append(simpletable, []string{"namespace", "function", "err reason"})
for check := range found.IterAll() {
if check.GetMasterBranchName() != check.GetCurrentBranchName() {
log.Info("FIND NEXT: YOU MUST BE ON THE MASTER BRANCH", check.GetNamespace())
continue
}
if check.IsDirty() {
// log.Info("FIND NEXT: CAN NOT RELEASE DIRTY REPO", check.GetNamespace())
simpletable = append(simpletable, []string{check.GetNamespace(), "CAN NOT RELEASE DIRTY REPO"})
continue
}
/*
if alreadyDone(check) {
log.Info("FIND NEXT: findNext() alreadyDone. WHY IS THIS STILL CHECKING?", check.GetNamespace())
continue
}
*/
// log.Info("FIND NEXT: CHECKING START:", check.GetNamespace())
if me.forge.Config.IsPrivate(check.GetNamespace()) {
log.Info("FIND NEXT: GOOD TO GO ON PRIVATE REPO", check.GetNamespace())
trythese = append(trythese, check)
continue
}
godepsNew, err := check.GoSumFromRepo()
if err != nil {
errs := fmt.Sprintf("%v", err)
simpletable = append(simpletable, []string{check.GetNamespace(), "check.GoSumFromRepo()", errs})
continue
}
if godepsNew == nil {
// don't check godepsNew, but check to make sure go mod tidy actually ran without error
os.Unsetenv("GO111MODULE")
cmd := []string{"go", "mod", "tidy"}
err := check.RunVerbose(cmd)
if err != nil {
log.Info("FIND NEXT: go mod tidy failed. this go package needs to be examined by hand as it doesn't appear to be primitive")
log.Info("FIND NEXT:", check.FullPath, cmd)
os.Exit(-1)
}
// if godepsNew == nil, then this go package is a primitive and there is no go.sum file
} else {
if err := testGoDepsCheckOk(godepsNew); err != nil {
log.Info("FIND NEXT: CHECKING current repo deps failed", err)
continue
}
}
if err := finalGoDepsCheckOk(check); err != nil {
// if err := me.forge.FinalGoDepsCheckOk(check, false); err != nil {
// log.Info("FIND NEXT: FinalGoDepsCheckOk() repo=", check.GetNamespace(), "err:", err)
// log.Info("FIND NEXT: CHECKING END:", check.GetNamespace())
// log.Info("FIND NEXT: ")
simpletable = append(simpletable, []string{check.GetNamespace(), fmt.Sprintf("FinalGoDepsCheckOk() err(%v)", err)})
continue
}
log.Info("FIND NEXT: GOOD TO GO ON", check.GetNamespace())
// setCurrentRepo(check, "should be good to release", "pretty sure")
trythese = append(trythese, check)
}
footer := cobol.SimpleTable(simpletable)
log.Info("reasons against publishing:", footer)
return trythese
}
|