almost automated again

This commit is contained in:
Jeff Carr 2024-12-02 10:43:48 -06:00
parent e9ecf2ed7e
commit c8fdd11ab6
5 changed files with 125 additions and 78 deletions

View File

@ -51,6 +51,9 @@ curl-setBranchesToMasterB:
findNext: findNext:
curl --silent http://localhost:9419/findNext curl --silent http://localhost:9419/findNext
fixNext:
curl --silent http://localhost:9419/fixNext
showNext: showNext:
curl --silent http://localhost:9419/showNext curl --silent http://localhost:9419/showNext

View File

@ -161,6 +161,11 @@ func doReleaseFindNext() bool {
if findNext() { if findNext() {
log.Info("findNext() found something") log.Info("findNext() found something")
} else { } else {
// this means findNext() didn't find anything but there are
// still packages to release. start trying to fix the go.sum files
if findCounter != 0 {
findFix = true
}
log.Info("findNext() could not find anything") log.Info("findNext() could not find anything")
return false return false
} }
@ -169,6 +174,9 @@ func doReleaseFindNext() bool {
log.Info("boo, you didn't git clone", me.current.GoPath()) log.Info("boo, you didn't git clone", me.current.GoPath())
return false return false
} }
if findFix {
fixGodeps(me.current)
}
if me.forge.FinalGoDepsCheckOk(check) { if me.forge.FinalGoDepsCheckOk(check) {
// the go.sum file is ok to release // the go.sum file is ok to release
return true return true

View File

@ -9,10 +9,14 @@ import (
"go.wit.com/lib/gui/repolist" "go.wit.com/lib/gui/repolist"
) )
var findCounter int
var findFix bool = false
// trys to figure out if there is still something to update // trys to figure out if there is still something to update
// todo: redo this logic as it is terrible // todo: redo this logic as it is terrible
// rename this findNext() // rename this findNext()
func findNext() bool { func findNext() bool {
findCounter = 0
loop := me.repos.View.ReposSortByName() loop := me.repos.View.ReposSortByName()
for loop.Scan() { for loop.Scan() {
repo := loop.Repo() repo := loop.Repo()
@ -46,12 +50,24 @@ func findNext() bool {
log.Info("boo, you didn't git clone", repo.GoPath()) log.Info("boo, you didn't git clone", repo.GoPath())
return false return false
} }
if findFix {
fixGodeps(repo)
}
findCounter += 1
if me.forge.FinalGoDepsCheckOk(check) { if me.forge.FinalGoDepsCheckOk(check) {
setCurrentRepo(repo, "should be good to release", "pretty sure") setCurrentRepo(repo, "should be good to release", "pretty sure")
return true return true
} }
} }
log.Info("tried to findNext() but not sure what to do next") if me.current == nil {
if findCounter == 0 {
log.Info("NOTHING TO UPDATE. findCounter =", findCounter)
} else {
findFix = true
log.Info("me.current is nil findCounter =", findCounter, "so set findFix =", findFix)
}
}
log.Info("tried to findNext() but not sure what to do next counter =", findCounter, "findFix =", findFix)
me.release.status.SetText("ALL DONE?") me.release.status.SetText("ALL DONE?")
return false return false
} }

155
http.go
View File

@ -156,83 +156,25 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
repo.Status.Whitelist = true repo.Status.Whitelist = true
} }
case "/testNext": case "/testNext":
// re-scans the go.sum file. DOES NOT MODIFY ANYTHING testNext()
check := me.forge.Repos.FindByGoPath(me.current.GoPath()) return
if check == nil { case "/fixNext":
log.Info("boo, you didn't git clone", me.current.GoPath()) // destroy and recreate the go.sum
return fixGodeps(me.current)
}
if me.forge.FinalGoDepsCheckOk(check) {
log.Info("finalGoDepsCheck(check) worked!")
} else {
log.Info("finalGoDepsCheck(check) failed. boo.")
}
return return
case "/showNext": case "/showNext":
log.Info("gui repo: " + me.release.repo.String()) showNext()
log.Info("gui name: " + me.release.version.String()) return
log.Info("gui notes: " + me.release.notes.String())
log.Info("gui status: " + me.release.status.String())
log.Info("")
if me.current == nil {
log.Info("me.current == nil")
return
}
if me.current.Status.IsReleased() {
log.Info("IsReleased() == true SHOULD NOT RELEASE THIS")
} else {
log.Info("IsReleased() == false")
}
if me.current.Status.CheckDirty() {
log.Info("CheckDirty() == true. SHOULD NOT RELEASE THIS")
} else {
log.Info("CheckDirty() == false")
}
if me.current.Status.IsPrimitive() {
log.Info("IsPrimitive() == true")
} else {
log.Info("IsPrimitive() == false")
}
if me.current.Status.IsPrivate() {
log.Info("IsPrivate() == true")
} else {
log.Info("IsPrivate() == false")
}
if ok, compiled, err := me.current.IsProtobuf(); ok {
log.Info(log.Sprint("IsProtobuf() == true compiled protobuf files = ", compiled))
if err != nil {
log.Info(log.Sprint("IsProtobuf() == err", err))
os.Exit(-1)
}
for _, s := range compiled {
log.Info("\tcompiled file found:", s)
}
} else {
log.Info("IsProtobuf() == false")
if err != nil {
log.Info(log.Sprint("IsProtobuf() == err", err))
}
}
if me.current.Status.Whitelist {
log.Info("Whitelist == true SHOULD NOT RELEASE THIS")
} else {
log.Info("Whitelist == false")
}
log.Info("")
log.Info(repolist.ReportHeader())
log.Info(me.current.StandardHeader())
log.Info("")
log.Info(repolist.ReleaseReportHeader())
log.Info(me.current.StandardReleaseHeader())
case "/list": case "/list":
PrintReport(readonly, onlydirty, perfect) PrintReport(readonly, onlydirty, perfect)
return
case "/releaseList": case "/releaseList":
PrintReleaseReport(readonly, perfect) PrintReleaseReport(readonly, perfect)
return
case "/quit": case "/quit":
log.Info("Got URL /quit") log.Info("Got URL /quit")
os.Exit(0) os.Exit(0)
return
case "/goweblist": case "/goweblist":
loop := me.repos.View.ReposAll() loop := me.repos.View.ReposAll()
for loop.Scan() { for loop.Scan() {
@ -262,6 +204,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
*/ */
} }
return
default: default:
log.Info("BAD URL = " + route) log.Info("BAD URL = " + route)
} }
@ -279,3 +222,79 @@ func startHTTP() {
log.Println("Error starting server:", err) log.Println("Error starting server:", err)
} }
} }
func 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.FinalGoDepsCheckOk(check) {
log.Info("finalGoDepsCheck(check) worked!")
} else {
log.Info("finalGoDepsCheck(check) failed. boo.")
}
}
func showNext() {
log.Info("gui repo: " + me.release.repo.String())
log.Info("gui name: " + me.release.version.String())
log.Info("gui notes: " + me.release.notes.String())
log.Info("gui status: " + me.release.status.String())
log.Info("")
if me.current == nil {
log.Info("me.current == nil")
return
}
if me.current.Status.IsReleased() {
log.Info("IsReleased() == true SHOULD NOT RELEASE THIS")
} else {
log.Info("IsReleased() == false")
}
if me.current.Status.CheckDirty() {
log.Info("CheckDirty() == true. SHOULD NOT RELEASE THIS")
} else {
log.Info("CheckDirty() == false")
}
if me.current.Status.IsPrimitive() {
log.Info("IsPrimitive() == true")
} else {
log.Info("IsPrimitive() == false")
}
if me.current.Status.IsPrivate() {
log.Info("IsPrivate() == true")
} else {
log.Info("IsPrivate() == false")
}
if ok, compiled, err := me.current.IsProtobuf(); ok {
log.Info(log.Sprint("IsProtobuf() == true compiled protobuf files = ", compiled))
if err != nil {
log.Info(log.Sprint("IsProtobuf() == err", err))
os.Exit(-1)
}
for _, s := range compiled {
log.Info("\tcompiled file found:", s)
}
} else {
log.Info("IsProtobuf() == false")
if err != nil {
log.Info(log.Sprint("IsProtobuf() == err", err))
}
}
if me.current.Status.Whitelist {
log.Info("Whitelist == true SHOULD NOT RELEASE THIS")
} else {
log.Info("Whitelist == false")
}
log.Info("")
log.Info(repolist.ReportHeader())
log.Info(me.current.StandardHeader())
log.Info("")
log.Info(repolist.ReleaseReportHeader())
log.Info(me.current.StandardReleaseHeader())
testNext()
}

View File

@ -11,6 +11,15 @@ func makePrepareRelease() {
me.release.box.Disable() me.release.box.Disable()
defer me.Enable() defer me.Enable()
if setAllBranchesToMaster() {
// if it succeeds, disable this button
me.setBranchesToMasterB.Disable()
me.release.box.Enable()
PrintReleaseReport("", "")
} else {
log.Info("setAllBranchesToMaster() failed")
}
// first reset all the target versions back to the current version // first reset all the target versions back to the current version
// incase there was a partial release process running that // incase there was a partial release process running that
// did not finish // did not finish
@ -65,7 +74,7 @@ func makePrepareRelease() {
log.Info("arg final check true", check.GetGoPath()) log.Info("arg final check true", check.GetGoPath())
} else { } else {
log.Info("arg final check false", check.GetGoPath()) log.Info("arg final check false", check.GetGoPath())
os.Exit(-1) // os.Exit(-1)
} }
// see if there is a new version // see if there is a new version
master := repo.Status.GetMasterVersion() master := repo.Status.GetMasterVersion()
@ -117,12 +126,4 @@ func makePrepareRelease() {
} }
} }
findNext() findNext()
if setAllBranchesToMaster() {
// if it succeeds, disable this button
me.setBranchesToMasterB.Disable()
me.release.box.Enable()
PrintReleaseReport("", "")
} else {
log.Info("setAllBranchesToMaster() failed")
}
} }