more rewriting of old code
This commit is contained in:
parent
02f7ee387f
commit
cfb4fb61bf
13
Makefile
13
Makefile
|
@ -25,9 +25,6 @@ install:
|
||||||
GO111MODULE=off go install \
|
GO111MODULE=off go install \
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
|
||||||
test: build
|
|
||||||
GUIRELEASE_REASON='test build' ./guireleaser
|
|
||||||
|
|
||||||
check-git-clean:
|
check-git-clean:
|
||||||
@git diff-index --quiet HEAD -- || (echo "Git repository is dirty, please commit your changes first"; exit 1)
|
@git diff-index --quiet HEAD -- || (echo "Git repository is dirty, please commit your changes first"; exit 1)
|
||||||
|
|
||||||
|
@ -40,9 +37,6 @@ redomod:
|
||||||
curl-help:
|
curl-help:
|
||||||
curl --silent http://localhost:9419/help
|
curl --silent http://localhost:9419/help
|
||||||
|
|
||||||
tempWin:
|
|
||||||
curl --silent http://localhost:9419/tempWin
|
|
||||||
|
|
||||||
curl-rescan-All:
|
curl-rescan-All:
|
||||||
curl --silent http://localhost:9419/rescanAll
|
curl --silent http://localhost:9419/rescanAll
|
||||||
|
|
||||||
|
@ -60,6 +54,9 @@ findNext:
|
||||||
showNext:
|
showNext:
|
||||||
curl --silent http://localhost:9419/showNext
|
curl --silent http://localhost:9419/showNext
|
||||||
|
|
||||||
|
testNext:
|
||||||
|
curl --silent http://localhost:9419/testNext
|
||||||
|
|
||||||
doRelease:
|
doRelease:
|
||||||
reset
|
reset
|
||||||
make curl-list-changed
|
make curl-list-changed
|
||||||
|
@ -70,6 +67,10 @@ doRelease:
|
||||||
curl-setCurrent-go-wit-com-gui:
|
curl-setCurrent-go-wit-com-gui:
|
||||||
curl --silent http://localhost:9419/setCurrentRepo?repo=go.wit.com/gui
|
curl --silent http://localhost:9419/setCurrentRepo?repo=go.wit.com/gui
|
||||||
|
|
||||||
|
curl-setCurrent-go-clone:
|
||||||
|
curl --silent http://localhost:9419/setCurrentRepo?repo=go.wit.com/apps/go-clone
|
||||||
|
make showNext
|
||||||
|
|
||||||
curl-setTargetVersion-virtigo-v0.1.1:
|
curl-setTargetVersion-virtigo-v0.1.1:
|
||||||
curl --silent http://localhost:9419/setTargetVersion?version=v0.1.1
|
curl --silent http://localhost:9419/setTargetVersion?version=v0.1.1
|
||||||
|
|
||||||
|
|
30
doRelease.go
30
doRelease.go
|
@ -29,11 +29,15 @@ func doRelease() bool {
|
||||||
if shell.Exists("go.mod") {
|
if shell.Exists("go.mod") {
|
||||||
log.Info("go.mod exists ok")
|
log.Info("go.mod exists ok")
|
||||||
} else {
|
} else {
|
||||||
pwd, _ := os.Getwd()
|
log.Info("go.mod missing")
|
||||||
log.Info("go.mod disappeared. need to run go mod init and go mod tidy here:", pwd)
|
return false
|
||||||
shell.RunRealtime([]string{"go", "mod", "init"})
|
/*
|
||||||
shell.RunRealtime([]string{"go", "mod", "tidy"})
|
pwd, _ := os.Getwd()
|
||||||
shell.RunRealtime([]string{"go", "mod", "edit", "-go=1.20"})
|
log.Info("go.mod disappeared. need to run go mod init and go mod tidy here:", pwd)
|
||||||
|
shell.RunRealtime([]string{"go", "mod", "init"})
|
||||||
|
shell.RunRealtime([]string{"go", "mod", "tidy"})
|
||||||
|
shell.RunRealtime([]string{"go", "mod", "edit", "-go=1.20"})
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
curName := me.current.Status.GetCurrentBranchName()
|
curName := me.current.Status.GetCurrentBranchName()
|
||||||
|
@ -43,7 +47,12 @@ func doRelease() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if !checkValidGoSum(me.current) {
|
check := me.forge.Repos.FindByGoPath(me.current.GoPath())
|
||||||
|
if check == nil {
|
||||||
|
log.Info("boo, you didn't git clone", me.current.GoPath())
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if !me.forge.FinalGoDepsCheck(check) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +125,7 @@ func doRelease() bool {
|
||||||
me.current.NewScan()
|
me.current.NewScan()
|
||||||
pb := me.forge.Repos.FindByGoPath(me.current.GoPath())
|
pb := me.forge.Repos.FindByGoPath(me.current.GoPath())
|
||||||
if pb != nil {
|
if pb != nil {
|
||||||
pb.RedoGoMod()
|
pb.ParseGoSum()
|
||||||
if pb.Published != nil {
|
if pb.Published != nil {
|
||||||
loop := pb.Published.SortByGoPath()
|
loop := pb.Published.SortByGoPath()
|
||||||
for loop.Scan() {
|
for loop.Scan() {
|
||||||
|
@ -153,7 +162,12 @@ func doReleaseFindNext() bool {
|
||||||
log.Info("findNext() could not find anything")
|
log.Info("findNext() could not find anything")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if checkValidGoSum(me.current) {
|
check := me.forge.Repos.FindByGoPath(me.current.GoPath())
|
||||||
|
if check == nil {
|
||||||
|
log.Info("boo, you didn't git clone", me.current.GoPath())
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if me.forge.FinalGoDepsCheck(check) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
87
findNext.go
87
findNext.go
|
@ -41,10 +41,12 @@ func findNext() bool {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Info("findNext()", repo.GoPath(), "is not a primative repo")
|
log.Info("findNext()", repo.GoPath(), "is not a primative repo")
|
||||||
if ! goodGodeps(repo) {
|
check := me.forge.Repos.FindByGoPath(repo.GoPath())
|
||||||
continue
|
if check == nil {
|
||||||
|
log.Info("boo, you didn't git clone", repo.GoPath())
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
if checkValidGoSum(repo) {
|
if me.forge.FinalGoDepsCheck(check) {
|
||||||
setCurrentRepo(repo, "should be good to release", "pretty sure")
|
setCurrentRepo(repo, "should be good to release", "pretty sure")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -54,22 +56,20 @@ func findNext() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func checkValidGoSum(repo *repolist.RepoRow) bool {
|
func checkValidGoSum(repo *repolist.RepoRow) bool {
|
||||||
ok, err := me.repos.View.CheckValidGoSum(repo)
|
if goodGodeps(repo) {
|
||||||
if err != nil {
|
|
||||||
log.Info("go mod tidy not ok", err)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if ok {
|
|
||||||
log.Info("repo has go.sum requirements that are clean")
|
log.Info("repo has go.sum requirements that are clean")
|
||||||
// me.current.setGoSumStatus("CLEAN")
|
// me.current.setGoSumStatus("CLEAN")
|
||||||
me.release.status.SetValue("GOOD")
|
me.release.status.SetValue("GOOD")
|
||||||
me.release.notes.SetValue("CheckValidGoSum() does not seem to lie")
|
me.release.notes.SetValue("CheckValidGoSum() does not seem to lie")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
log.Info("go mod tidy not ok")
|
||||||
me.release.notes.SetValue("CheckValidGoSum() failed")
|
me.release.notes.SetValue("CheckValidGoSum() failed")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func goodGodeps(repo *repolist.RepoRow) bool {
|
func goodGodeps(repo *repolist.RepoRow) bool {
|
||||||
var good bool = true
|
var good bool = true
|
||||||
|
@ -79,7 +79,7 @@ func goodGodeps(repo *repolist.RepoRow) bool {
|
||||||
log.Info("boo, you didn't git clone", repo.GoPath())
|
log.Info("boo, you didn't git clone", repo.GoPath())
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
check.RedoGoMod()
|
// check.RedoGoMod()
|
||||||
log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
|
log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
|
||||||
deps := check.GoDeps.SortByGoPath()
|
deps := check.GoDeps.SortByGoPath()
|
||||||
for deps.Scan() {
|
for deps.Scan() {
|
||||||
|
@ -103,23 +103,54 @@ func goodGodeps(repo *repolist.RepoRow) bool {
|
||||||
log.Info("bad", header)
|
log.Info("bad", header)
|
||||||
good = false
|
good = false
|
||||||
}
|
}
|
||||||
|
return good
|
||||||
/*
|
}
|
||||||
log.Info(repolist.ReleaseReportHeader())
|
|
||||||
loop := me.repos.View.ReposSortByName()
|
// tries to fix the go.mod and go.sum files
|
||||||
for loop.Scan() {
|
func fixGodeps(repo *repolist.RepoRow) bool {
|
||||||
repo := loop.Repo()
|
var good bool = true
|
||||||
|
// check if the package dependancies changed, if so, re-publish
|
||||||
// if repo.ReadOnly() {
|
check := me.forge.Repos.FindByGoPath(repo.GoPath())
|
||||||
// continue
|
if check == nil {
|
||||||
// }
|
log.Info("boo, you didn't git clone", repo.GoPath())
|
||||||
if repo.Status.IsReleased() {
|
os.Exit(-1)
|
||||||
continue
|
}
|
||||||
}
|
check.RedoGoMod()
|
||||||
header := repo.StandardReleaseHeader()
|
log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
|
||||||
log.Info(header)
|
deps := check.GoDeps.SortByGoPath()
|
||||||
}
|
for deps.Scan() {
|
||||||
*/
|
depRepo := deps.Next()
|
||||||
|
// log.Info("found dep", depRepo.GetGoPath())
|
||||||
|
if me.forge.IsReadOnly(depRepo.GetGoPath()) {
|
||||||
|
log.Info("IsReadOnly = true", depRepo.GetGoPath())
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
// log.Info("IsReadOnly = false", depRepo.GetGoPath())
|
||||||
|
}
|
||||||
|
found := me.repos.View.FindByPath(depRepo.GetGoPath())
|
||||||
|
if found == nil {
|
||||||
|
log.Info("not found:", depRepo.GetGoPath())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if depRepo.GetVersion() != found.Status.GetMasterVersion() {
|
||||||
|
log.Printf("%-48s %10s (from gitpb)", depRepo.GetGoPath(), depRepo.GetVersion())
|
||||||
|
header := found.StandardReleaseHeader()
|
||||||
|
log.Info(header, "(from repolist)")
|
||||||
|
cmd := []string{"go", "get", depRepo.GetGoPath() + "@latest"}
|
||||||
|
check.Run(cmd)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cmd := []string{"go", "mod", "tidy"}
|
||||||
|
check.Run(cmd)
|
||||||
|
cmd = []string{"go", "mod", "edit", "-go=1.20"}
|
||||||
|
check.Run(cmd)
|
||||||
|
check.GoDeps = nil
|
||||||
|
check.ParseGoSum()
|
||||||
|
|
||||||
|
deps = check.GoDeps.SortByGoPath()
|
||||||
|
for deps.Scan() {
|
||||||
|
depRepo := deps.Next()
|
||||||
|
log.Info("found updated dep", depRepo.GetGoPath(), depRepo.GetVersion())
|
||||||
|
}
|
||||||
return good
|
return good
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,50 +30,7 @@ func globalDisplayOptions(box *gui.Node) {
|
||||||
grid := group1.RawGrid()
|
grid := group1.RawGrid()
|
||||||
|
|
||||||
grid.NewButton("make prepare-release", func() {
|
grid.NewButton("make prepare-release", func() {
|
||||||
me.Disable()
|
makePrepareRelease()
|
||||||
me.release.box.Disable()
|
|
||||||
defer me.Enable()
|
|
||||||
loop := me.repos.View.ReposSortByName()
|
|
||||||
for loop.Scan() {
|
|
||||||
repo := loop.Repo()
|
|
||||||
// check if the package dependancies changed, if so, re-publish
|
|
||||||
check := me.forge.Repos.FindByGoPath(repo.GoPath())
|
|
||||||
if check == nil {
|
|
||||||
log.Info("boo, you didn't git clone", repo.GoPath())
|
|
||||||
os.Exit(-1)
|
|
||||||
}
|
|
||||||
match, err := me.forge.Repos.GoDepsChanged(check)
|
|
||||||
if err != nil {
|
|
||||||
log.Info("dependancy checks failed", check.GetGoPath(), err)
|
|
||||||
repo.Status.IncrementRevisionVersion("missing prior published godeps")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if match {
|
|
||||||
log.Printf("dependancy checks indicate a new release is needed for %s\n", check.GetGoPath())
|
|
||||||
repo.Status.IncrementRevisionVersion("godeps changed")
|
|
||||||
continue
|
|
||||||
} else {
|
|
||||||
log.Printf("dependancies have not changed for %s\n", check.GetGoPath())
|
|
||||||
}
|
|
||||||
|
|
||||||
// see if there is a new version
|
|
||||||
master := repo.Status.GetMasterVersion()
|
|
||||||
lastTag := repo.Status.LastTag()
|
|
||||||
if master == lastTag {
|
|
||||||
repo.Status.SetTargetVersion(master)
|
|
||||||
} else {
|
|
||||||
repo.Status.IncrementRevisionVersion("Nov 2024 test")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
findNext()
|
|
||||||
if setAllBranchesToMaster() {
|
|
||||||
// if it succeeds, disable this button
|
|
||||||
me.setBranchesToMasterB.Disable()
|
|
||||||
me.release.box.Enable()
|
|
||||||
me.repos.View.PrintReleaseReport("", "")
|
|
||||||
} else {
|
|
||||||
log.Info("setAllBranchesToMaster() failed")
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
grid.NextRow()
|
grid.NextRow()
|
||||||
|
|
||||||
|
@ -86,3 +43,50 @@ func globalDisplayOptions(box *gui.Node) {
|
||||||
debugger.DebugWindow()
|
debugger.DebugWindow()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func makePrepareRelease() {
|
||||||
|
me.Disable()
|
||||||
|
me.release.box.Disable()
|
||||||
|
defer me.Enable()
|
||||||
|
loop := me.repos.View.ReposSortByName()
|
||||||
|
for loop.Scan() {
|
||||||
|
repo := loop.Repo()
|
||||||
|
// check if the package dependancies changed, if so, re-publish
|
||||||
|
check := me.forge.Repos.FindByGoPath(repo.GoPath())
|
||||||
|
if check == nil {
|
||||||
|
log.Info("boo, you didn't git clone", repo.GoPath())
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
match, err := me.forge.Repos.GoDepsChanged(check)
|
||||||
|
if err != nil {
|
||||||
|
log.Info("dependancy checks failed", check.GetGoPath(), err)
|
||||||
|
repo.Status.IncrementRevisionVersion("missing prior published godeps")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if match {
|
||||||
|
log.Printf("dependancy checks indicate a new release is needed for %s\n", check.GetGoPath())
|
||||||
|
repo.Status.IncrementRevisionVersion("godeps changed")
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
log.Printf("dependancies have not changed for %s\n", check.GetGoPath())
|
||||||
|
}
|
||||||
|
|
||||||
|
// see if there is a new version
|
||||||
|
master := repo.Status.GetMasterVersion()
|
||||||
|
lastTag := repo.Status.LastTag()
|
||||||
|
if master == lastTag {
|
||||||
|
repo.Status.SetTargetVersion(master)
|
||||||
|
} else {
|
||||||
|
repo.Status.IncrementRevisionVersion("Nov 2024 test")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
findNext()
|
||||||
|
if setAllBranchesToMaster() {
|
||||||
|
// if it succeeds, disable this button
|
||||||
|
me.setBranchesToMasterB.Disable()
|
||||||
|
me.release.box.Enable()
|
||||||
|
me.repos.View.PrintReleaseReport("", "")
|
||||||
|
} else {
|
||||||
|
log.Info("setAllBranchesToMaster() failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
19
http.go
19
http.go
|
@ -155,6 +155,19 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
repo.Status.Whitelist = true
|
repo.Status.Whitelist = true
|
||||||
}
|
}
|
||||||
|
case "/testNext":
|
||||||
|
// re-scans the go.sum file. DOES NOT MODIFY ANYTHING
|
||||||
|
check := me.forge.Repos.FindByGoPath(me.current.GoPath())
|
||||||
|
if check == nil {
|
||||||
|
log.Info("boo, you didn't git clone", me.current.GoPath())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if me.forge.FinalGoDepsCheck(check) {
|
||||||
|
log.Info("finalGoDepsCheck(check) worked!")
|
||||||
|
} else {
|
||||||
|
log.Info("finalGoDepsCheck(check) failed. boo.")
|
||||||
|
}
|
||||||
|
return
|
||||||
case "/showNext":
|
case "/showNext":
|
||||||
log.Info("gui repo: " + me.release.repo.String())
|
log.Info("gui repo: " + me.release.repo.String())
|
||||||
log.Info("gui name: " + me.release.version.String())
|
log.Info("gui name: " + me.release.version.String())
|
||||||
|
@ -166,11 +179,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if checkValidGoSum(me.current) {
|
|
||||||
log.Info("checkValidGoSum() == true")
|
|
||||||
} else {
|
|
||||||
log.Info("checkValidGoSum() == false SHOULD NOT RELEASE THIS")
|
|
||||||
}
|
|
||||||
if me.current.Status.IsReleased() {
|
if me.current.Status.IsReleased() {
|
||||||
log.Info("IsReleased() == true SHOULD NOT RELEASE THIS")
|
log.Info("IsReleased() == true SHOULD NOT RELEASE THIS")
|
||||||
} else {
|
} else {
|
||||||
|
@ -212,6 +220,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Info("Whitelist == false")
|
log.Info("Whitelist == false")
|
||||||
}
|
}
|
||||||
log.Info("")
|
log.Info("")
|
||||||
|
fixGodeps(me.current)
|
||||||
|
|
||||||
log.Info(repolist.ReportHeader())
|
log.Info(repolist.ReportHeader())
|
||||||
log.Info(me.current.StandardHeader())
|
log.Info(me.current.StandardHeader())
|
||||||
|
|
3
main.go
3
main.go
|
@ -154,6 +154,9 @@ func main() {
|
||||||
}
|
}
|
||||||
me.Enable()
|
me.Enable()
|
||||||
|
|
||||||
|
// set all branches to master & findNext()
|
||||||
|
makePrepareRelease()
|
||||||
|
|
||||||
// intermittently scans the status indefinitly
|
// intermittently scans the status indefinitly
|
||||||
me.repos.View.Watchdog(func() {
|
me.repos.View.Watchdog(func() {
|
||||||
log.Info("In main()")
|
log.Info("In main()")
|
||||||
|
|
|
@ -133,9 +133,9 @@ func createReleaseBox(box *gui.Node) {
|
||||||
findNext()
|
findNext()
|
||||||
})
|
})
|
||||||
|
|
||||||
me.release.checkGoSumB = grid.NewButton("checkValidGoSum()", func() {
|
me.release.checkGoSumB = grid.NewButton("fixGoDeps()", func() {
|
||||||
buttonDisable()
|
buttonDisable()
|
||||||
checkValidGoSum(me.current)
|
fixGodeps(me.current)
|
||||||
buttonEnable()
|
buttonEnable()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -246,8 +246,7 @@ func createReleaseBox(box *gui.Node) {
|
||||||
if repo.Status.Whitelist {
|
if repo.Status.Whitelist {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ok, err := me.repos.View.CheckValidGoSum(repo)
|
if !goodGodeps(repo) {
|
||||||
if !ok {
|
|
||||||
log.Info("redo go.sum failed on", repo.GoPath(), err)
|
log.Info("redo go.sum failed on", repo.GoPath(), err)
|
||||||
worked = false
|
worked = false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue