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
} }

125
http.go
View File

@ -156,6 +156,74 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
repo.Status.Whitelist = true repo.Status.Whitelist = true
} }
case "/testNext": case "/testNext":
testNext()
return
case "/fixNext":
// destroy and recreate the go.sum
fixGodeps(me.current)
return
case "/showNext":
showNext()
return
case "/list":
PrintReport(readonly, onlydirty, perfect)
return
case "/releaseList":
PrintReleaseReport(readonly, perfect)
return
case "/quit":
log.Info("Got URL /quit")
os.Exit(0)
return
case "/goweblist":
loop := me.repos.View.ReposAll()
for loop.Scan() {
repo := loop.Repo()
lastTag := repo.LastTag()
tag := repo.Status.NewestTag()
gitAge, err := tag.GetDate()
if err != nil {
log.Info(fmt.Sprintf("tag date error", repo.Name()))
}
// if lastTag == "" {
// lastTag = tag.Name()
// }
if repo.ReadOnly() {
if readonly == "true" {
continue
}
}
// dur := time.Since(gitAge)
// log.Info(fmt.Sprintf("%-60s %s %s %s", repo.Name(), lastTag, shell.FormatDuration(dur), lastTag, tag.Name()))
log.Info(fmt.Sprintf("%s %d %s", repo.Name(), gitAge.Unix(), lastTag))
/*
for _, tag := range repo.Tags.ListAll() {
log.Info(fmt.Sprintf("%-60s %s", "", tag.Name()))
}
*/
}
return
default:
log.Info("BAD URL = " + route)
}
}
// starts and sits waiting for HTTP requests
func startHTTP() {
http.HandleFunc("/", okHandler)
p := fmt.Sprintf(":%d", argv.Port)
log.Println("Running on port", p)
err := http.ListenAndServe(p, nil)
if err != nil {
log.Println("Error starting server:", err)
}
}
func testNext() {
// re-scans the go.sum file. DOES NOT MODIFY ANYTHING // re-scans the go.sum file. DOES NOT MODIFY ANYTHING
check := me.forge.Repos.FindByGoPath(me.current.GoPath()) check := me.forge.Repos.FindByGoPath(me.current.GoPath())
if check == nil { if check == nil {
@ -167,8 +235,9 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
} else { } else {
log.Info("finalGoDepsCheck(check) failed. boo.") log.Info("finalGoDepsCheck(check) failed. boo.")
} }
return }
case "/showNext":
func 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())
log.Info("gui notes: " + me.release.notes.String()) log.Info("gui notes: " + me.release.notes.String())
@ -226,56 +295,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
log.Info("") log.Info("")
log.Info(repolist.ReleaseReportHeader()) log.Info(repolist.ReleaseReportHeader())
log.Info(me.current.StandardReleaseHeader()) log.Info(me.current.StandardReleaseHeader())
case "/list":
PrintReport(readonly, onlydirty, perfect)
case "/releaseList":
PrintReleaseReport(readonly, perfect)
case "/quit":
log.Info("Got URL /quit")
os.Exit(0)
case "/goweblist":
loop := me.repos.View.ReposAll()
for loop.Scan() {
repo := loop.Repo()
lastTag := repo.LastTag() testNext()
tag := repo.Status.NewestTag()
gitAge, err := tag.GetDate()
if err != nil {
log.Info(fmt.Sprintf("tag date error", repo.Name()))
}
// if lastTag == "" {
// lastTag = tag.Name()
// }
if repo.ReadOnly() {
if readonly == "true" {
continue
}
}
// dur := time.Since(gitAge)
// log.Info(fmt.Sprintf("%-60s %s %s %s", repo.Name(), lastTag, shell.FormatDuration(dur), lastTag, tag.Name()))
log.Info(fmt.Sprintf("%s %d %s", repo.Name(), gitAge.Unix(), lastTag))
/*
for _, tag := range repo.Tags.ListAll() {
log.Info(fmt.Sprintf("%-60s %s", "", tag.Name()))
}
*/
}
default:
log.Info("BAD URL = " + route)
}
}
// starts and sits waiting for HTTP requests
func startHTTP() {
http.HandleFunc("/", okHandler)
p := fmt.Sprintf(":%d", argv.Port)
log.Println("Running on port", p)
err := http.ListenAndServe(p, nil)
if err != nil {
log.Println("Error starting server:", err)
}
} }

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")
}
} }