summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-30 01:15:00 -0600
committerJeff Carr <[email protected]>2025-01-30 01:15:00 -0600
commitffb90cd28f4e166af5e7fc00d34a0b38516ddb21 (patch)
tree219882980a57ae01dd8bd6a4bc6017079b50e6a0
parentf690c1a8a328d1b136af728538c418849391e572 (diff)
this process is annoying
-rw-r--r--doRelease.go76
-rw-r--r--findNext.go71
-rw-r--r--http.go2
-rw-r--r--main.go20
-rw-r--r--prepareRelease.go33
-rw-r--r--releaseBox.go44
6 files changed, 146 insertions, 100 deletions
diff --git a/doRelease.go b/doRelease.go
index ee4c4b4..9c8f910 100644
--- a/doRelease.go
+++ b/doRelease.go
@@ -12,23 +12,24 @@ import (
"go.wit.com/log"
)
-func doRelease() bool {
+func doRelease() error {
+ check := me.current
log.Info("doRelease() on", me.current.GetGoPath())
if !findOk {
log.Info("doRelease() immediately end something went wrong last time. findOk == false")
- return false
+ return fmt.Errorf("findOK = false %s", check.GetGoPath())
}
// double check release version logic
if me.release.releaseVersionB.String() != "release version "+me.release.version.String() {
log.Warn("something went wrong with the release.version:", me.release.version.String())
- return false
+ return fmt.Errorf("GUI lied %s", check.GetGoPath())
}
if strings.HasPrefix(me.release.version.String(), "v") {
log.Warn("everything is ok. version starts with v.", me.release.version.String())
} else {
log.Warn("version does not start with v.", me.release.version.String())
- return false
+ return fmt.Errorf("release does not start with a v %s", check.GetGoPath())
}
if shell.Exists("go.mod") {
@@ -36,22 +37,16 @@ func doRelease() bool {
} else {
pwd, _ := os.Getwd()
log.Info("go.mod missing in working dir", pwd)
- return false
+ return fmt.Errorf("go.mod missing %s", check.GetGoPath())
}
curName := me.current.GetCurrentBranchName()
mName := me.current.GetMasterBranchName()
if curName != mName {
log.Info("\trepo is not working from main branch", curName, "!=", mName)
- return false
+ return fmt.Errorf("not on main branch %s", check.GetGoPath())
}
- // check := me.forge.FindByGoPath(me.current.GetGoPath())
- check := me.current
- if check == nil {
- log.Info("boo, you didn't git clone", me.current.GetGoPath())
- return false
- }
if alreadyDone(check) {
// means it was already published
// protects against logic errors that might result
@@ -60,14 +55,13 @@ func doRelease() bool {
log.Info("doRelease() WARNING. should have never gotten here. return true. already done", check.GetGoPath())
log.Info("doRelease() WARNING. should have never gotten here. return true. already done", check.GetGoPath())
check.Reload()
- log.Sleep(1)
- return true
+ return fmt.Errorf("already released %s", check.GetGoPath())
}
me.done = append(me.done, me.current.GetGoPath())
if err := me.forge.FinalGoDepsCheckOk(check, true); err != nil {
msg := fmt.Sprint("the go.mod file is wrong. fix it here?", check.GetGoPath())
badExit(errors.New(msg))
- return false
+ return fmt.Errorf("FinalGoDeps %s err %v", check.GetGoPath(), err)
}
if check.GetGoPath() == me.startRepo.GetGoPath() {
log.Info("CAN NOT SELF UPDATE.", check.GetGoPath(), "is the same as os.Getwd()")
@@ -136,7 +130,7 @@ func doRelease() bool {
if !me.current.RunAll(all) {
log.Info("failed to make new release", me.release.version.String())
findOk = false
- return false
+ return fmt.Errorf("setting findOK = false %s", check.GetGoPath())
}
log.Info("RELEASE OK")
@@ -147,7 +141,7 @@ func doRelease() bool {
if !doPublishVersion() {
log.Info("PUBLISH FAILED")
findOk = false
- return false
+ return fmt.Errorf("PUBLISH FAILED %s", check.GetGoPath())
}
}
@@ -159,7 +153,7 @@ func doRelease() bool {
if !me.current.RevertMasterToDevel() {
log.Info("Revert Failed")
findOk = false
- return false
+ return fmt.Errorf("REVERT FAILED %s", check.GetGoPath())
}
// update tag
@@ -179,7 +173,7 @@ func doRelease() bool {
if !me.current.RunAll(retag) {
log.Info("retag failed")
findOk = false
- return false
+ return fmt.Errorf("RETAG FAILED %s", check.GetGoPath())
}
log.Info("EVERYTHING OK. RERELEASED", me.current.GetGoPath())
@@ -191,31 +185,40 @@ func doRelease() bool {
badExit(errors.New(msg))
}
+ me.forge.SetConfigSave(true)
+ me.forge.ConfigSave()
+ log.Info("sleep 2")
+ time.Sleep(2 * time.Second)
printDone()
- log.Info("sleep 2, then Reload()", check.GetGoPath())
- time.Sleep(2 * time.Second) // notsure
- check.Reload()
- // run this each time something gets published successfully
- rePrepareRelease()
+ /*
+ // run this each time something gets published successfully
- findNext()
-
- // attempt to find another repo to release
- if !doReleaseFindNext() {
- log.Info("doReleaseFindNext() could not find a new", findCounter)
- log.Info("THIS PROBABLY MEANS THAT ACTUALLY WE ARE TOTALLY DONE?", findCounter)
- count := me.forge.PrintReleaseReport(me.found)
- log.Info("count =", count)
- os.Setenv("FindNextDone", "true")
+ // attempt to find another repo to release
+ if !doReleaseFindNext() {
+ log.Info("doReleaseFindNext() could not find a new", findCounter)
+ log.Info("THIS PROBABLY MEANS THAT ACTUALLY WE ARE TOTALLY DONE?", findCounter)
+ count := me.forge.PrintReleaseReport(me.found)
+ log.Info("count =", count)
+ os.Setenv("FindNextDone", "true")
+ printDone()
+ return false
+ }
printDone()
- return false
+ */
+ rePrepareRelease()
+ findNext()
+ if me.current == nil {
+ log.Info("NOT GOOD TO RUN ANOTHER DAY")
+ log.Info("took out all the loop code")
+ setCurrentRepo(nil, "loop by hand motherfucker", "fucknuts")
+ return fmt.Errorf("findNext returned next repo == nil")
}
log.Info("GOOD TO RUN ANOTHER DAY ON:", me.current.GetGoPath())
- printDone()
- return true
+ return nil
}
+/*
// try to figure out if there is another package to update
// returns true if it finds something
func doReleaseFindNext() bool {
@@ -246,6 +249,7 @@ func doReleaseFindNext() bool {
}
return false
}
+*/
// this pulls the new tag from the golang package repository
// to insert the new version
diff --git a/findNext.go b/findNext.go
index d307343..f7e7927 100644
--- a/findNext.go
+++ b/findNext.go
@@ -3,6 +3,7 @@ package main
import (
"fmt"
+ "slices"
"go.wit.com/log"
@@ -85,22 +86,39 @@ func findNext() bool {
continue
}
- if err := me.forge.CleanGoDepsCheckOk(check); err != nil {
- log.Info("CleanGoDepsCheckOk() failed", check.GetGoPath(), err)
- log.Info("CleanGoDepsCheckOk() failed", check.GetGoPath(), err)
- continue
- }
+ /*
+ if err := me.forge.CleanGoDepsCheckOk(check); err != nil {
+ log.Info("CleanGoDepsCheckOk() failed", check.GetGoPath(), err)
+ log.Info("CleanGoDepsCheckOk() failed", check.GetGoPath(), err)
+ continue
+ }
+ */
- if err := checkDeps(check); err != nil {
- log.Info("\t", check.GetGoPath(), err)
- continue
- } else {
- log.Info("Might be ok?", check.GetGoPath())
- }
+ /*
+ if err := checkDeps(check); err != nil {
+ log.Info("CHECK DEPS FAILED", check.GetGoPath(), err)
+ log.Info("CHECK DEPS FAILED", check.GetGoPath(), err)
+ log.Info("CHECK DEPS FAILED", check.GetGoPath(), err)
+ continue
+ } else {
+ log.Info("Might be ok?", check.GetGoPath())
+ }
+ */
+ fixGodeps(check)
+ /*
+ } else {
+ log.Info("SKIPPING FIX", check.GetGoPath())
+ log.Info("SKIPPING FIX", check.GetGoPath())
+ log.Info("SKIPPING FIX", check.GetGoPath())
+ }
+ */
if err := me.forge.FinalGoDepsCheckOk(check, argv.Verbose); err != nil {
+ // if err := me.forge.FinalGoDepsCheckOk(check, false); err != nil {
log.Info("FinalGoDepsCheckOk() repo=", check.GetGoPath(), "err:", err)
log.Info("FinalGoDepsCheckOk() repo=", check.GetGoPath(), "err:", err)
+ log.Info("CHECKING END:", check.GetGoPath())
+ log.Info("")
continue
}
log.Info("GOOD TO GO ON", check.GetGoPath())
@@ -110,10 +128,10 @@ func findNext() bool {
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)
+ setCurrentRepo(nil, "findNext found nothing", "crap")
me.release.status.SetText("ALL DONE?")
return false
}
@@ -127,16 +145,24 @@ func fixGodeps(check *gitpb.Repo) bool {
check.GoDeps = nil
- if _, err := check.RunVerboseOnError([]string{"go-mod-clean", "--strict"}); err != nil {
- log.Info("fixGoDeps() runGoClean() strict failed", check.GetGoPath(), err)
- log.Info("fixGoDeps() runGoClean() strict failed", check.GetGoPath(), err)
- log.Info("fixGoDeps() runGoClean() strict failed", check.GetGoPath(), err)
+ if result, err := check.RunStrictNew([]string{"go-mod-clean", "--strict"}); err != nil {
+ // log.Info("fixGoDeps() runGoClean() strict failed", check.GetGoPath(), err)
+ // log.Info("fixGoDeps() runGoClean() strict failed", check.GetGoPath(), len(result.Stdout), len(result.Stderr))
+ if len(result.Stderr) > 0 {
+ slices.Reverse(result.Stderr)
+ log.Info("fixGoDeps() runGoClean() strict failed", check.GetGoPath(), result.Stderr[0])
+ }
+ if len(result.Stdout) > 0 {
+ slices.Reverse(result.Stdout)
+ log.Info("fixGoDeps() runGoClean() strict failed", check.GetGoPath(), result.Stdout[0])
+ }
+ // log.Info("fixGoDeps() runGoClean() strict failed", check.GetGoPath())
return false
}
if check.ParseGoSum() {
return true
} else {
- log.Info("ParseGoSum() failed", check.GetGoPath())
+ log.Info("ParseGoSum() failed but go-mod-clean --strict worked", check.GetGoPath())
return false
}
// skip primative ones
@@ -178,12 +204,19 @@ func fixGodeps(check *gitpb.Repo) bool {
}
func setCurrentRepo(check *gitpb.Repo, s string, note string) bool {
- me.release.repo.SetText(check.GetGoPath())
+ if check == nil {
+ me.release.repo.SetText("")
+ me.release.version.SetText("")
+ me.release.releaseVersionB.SetText("nope")
+ } else {
+ me.release.repo.SetText(check.GetGoPath())
+ me.release.version.SetText(check.GetTargetVersion())
+ me.release.releaseVersionB.SetText("release version " + check.GetTargetVersion())
+ }
me.release.status.SetText(s)
me.release.notes.SetText(note)
me.current = check
me.release.version.SetText(check.GetTargetVersion())
- me.release.releaseVersionB.SetText("release version " + check.GetTargetVersion())
me.release.openrepo.Enable()
return true
diff --git a/http.go b/http.go
index c5f4123..0a10b7b 100644
--- a/http.go
+++ b/http.go
@@ -46,7 +46,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
log.Info("")
case "/doRelease":
buttonDisable()
- if doRelease() {
+ if err := doRelease(); err == nil {
buttonEnable()
log.Info("doRelease() worked")
} else {
diff --git a/main.go b/main.go
index 62753f3..6436776 100644
--- a/main.go
+++ b/main.go
@@ -74,9 +74,6 @@ func main() {
}
me.mainBox = me.mainWindow.NewBox("bw hbox", true)
- // start the http server for polling status
- go startHTTP()
-
// sanity check of things that might be around that mess
// up things later
// if you have a go.work file, you must delete it
@@ -131,10 +128,15 @@ func main() {
me.Enable()
me.release.box.Enable()
- // intermittently scans the status indefinitly
- me.repos.View.Watchdog(func() {
- log.Info("In main()")
- // processing is done. update the repo summary box
- // me.summary.Update()
- })
+ /*
+ // intermittently scans the status indefinitly
+ me.repos.View.Watchdog(func() {
+ log.Info("In main()")
+ log.Sleep(10)
+ // processing is done. update the repo summary box
+ // me.summary.Update()
+ })
+ */
+ // start the http server for polling status
+ startHTTP()
}
diff --git a/prepareRelease.go b/prepareRelease.go
index cab4321..78fdd34 100644
--- a/prepareRelease.go
+++ b/prepareRelease.go
@@ -19,7 +19,6 @@ func forceReleaseVersion(repo *gitpb.Repo) {
// if v1.2.3 change to v.1.2.4
repo.IncrementTargetRevision()
}
- me.forge.SetConfigSave(true)
}
func checkpkgcache(repo *gitpb.Repo) error {
@@ -37,10 +36,13 @@ func checkpkgcache(repo *gitpb.Repo) error {
}
getpath := repo.GetGoPath() + "@" + repo.GetLastTag()
+ log.Info("MISSING:", getpath)
_, err = me.startRepo.RunVerboseOnError([]string{"go", "get", getpath})
return err
}
+var rillcount int
+
func rillRestore(repo *gitpb.Repo) error {
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
return nil
@@ -48,10 +50,9 @@ func rillRestore(repo *gitpb.Repo) error {
if me.forge.Config.IsPrivate(repo.GetGoPath()) {
return nil
}
- if err := checkpkgcache(repo); err != nil {
- return err
- }
+
_, err := repo.RunStrictNew([]string{"go-mod-clean", "--restore"})
+ rillcount += 1
if err != nil {
log.Info("go-mod-clean --restore failed", repo.GetGoPath(), err)
return err
@@ -64,9 +65,26 @@ func rePrepareRelease() {
// me.forge = forgepb.Init()
me.found = new(gitpb.Repos)
+ log.Printf("rePrepareRelease() START rill go-mod-clean --restore (11 seconds?)")
+ rillcount = 0
now := time.Now()
me.forge.RillFuncError(rillRestore)
- log.Printf("showRestore() (%d total repos) took:%s\n", me.forge.Repos.Len(), shell.FormatDuration(time.Since(now)))
+ log.Printf("showRestore() (%d total repos) took:%s\n", rillcount, shell.FormatDuration(time.Since(now)))
+ log.Sleep(1)
+ all2 := me.forge.Repos.SortByFullPath()
+ for all2.Scan() {
+ check := all2.Next()
+ if me.forge.Config.IsReadOnly(check.GetGoPath()) {
+ continue
+ }
+ if me.forge.Config.IsPrivate(check.GetGoPath()) {
+ continue
+ }
+ // this should be rare? nonexistant?
+ if err := checkpkgcache(check); err != nil {
+ log.Info("go get checks failed here.", err, check.GetGoPath())
+ }
+ }
all := me.forge.Repos.SortByFullPath()
for all.Scan() {
@@ -112,6 +130,11 @@ func rePrepareRelease() {
continue
}
+ if me.forge.Config.IsPrivate(check.GetGoPath()) {
+ // only checks after this are GO dep related which don't matter for private repos
+ continue
+ }
+
if argv.Quick != nil {
// if argv has 'quick' don't do anything
// that doesn't actually have a patch
diff --git a/releaseBox.go b/releaseBox.go
index d49b0a0..15f68c8 100644
--- a/releaseBox.go
+++ b/releaseBox.go
@@ -3,7 +3,6 @@ package main
import (
"fmt"
- "os"
"time"
"go.wit.com/gui"
@@ -51,14 +50,14 @@ func createReleaseBox(box *gui.Node) {
me.release.releaseVersionB = me.release.grid.NewButton("release version", func() {
buttonDisable()
- if doRelease() {
+ if err := doRelease(); err == nil {
buttonEnable()
log.Info("doRelease() worked")
} else {
- log.Info("doRelease() failed")
+ log.Info("doRelease() failed", err, me.current.GetGoPath())
}
})
- me.release.grid.NewButton("Find Next Releasable", func() {
+ me.release.grid.NewButton("Find Next", func() {
me.Disable()
defer me.Enable()
if findNext() {
@@ -66,6 +65,15 @@ func createReleaseBox(box *gui.Node) {
return
}
})
+ me.release.grid.NewButton("Show Next", func() {
+ check := me.current
+ if check == nil {
+ log.Info("boo, current is missing", me.current.GetGoPath())
+ return
+ }
+ testGoRepo(check)
+ me.forge.HumanPrintRepo(check)
+ })
me.release.grid.NextRow()
me.release.repo = gadgets.NewOneLiner(me.release.grid, "repo")
@@ -181,21 +189,6 @@ func createReleaseBox(box *gui.Node) {
buttonEnable()
})
grid.NextRow()
-
- group = me.release.box.NewGroup("experimental and potentially dangerous stuff")
- grid = group.NewGrid("buildOptions", 0, 0)
-
- me.setBranchesToMasterB = grid.NewButton("set all branches to master", func() {
- me.Disable()
- defer me.Enable()
- /*
- if setAllBranchesToMaster() {
- // if it succeeds, disable this button
- me.setBranchesToMasterB.Disable()
- }
- */
- })
- grid.NextRow()
}
func doReleaseAll() (bool, time.Duration) {
@@ -210,19 +203,10 @@ func doReleaseAll() (bool, time.Duration) {
worked = false
break
}
- if doRelease() {
+ if err := doRelease(); err == nil {
log.Info("doRelease() worked. findCounter =", findCounter)
} else {
- if os.Getenv("FindNextDone") == "true" {
- log.Info("findNext says it was done. findCounter =", findCounter)
- log.Info("findNext says it was done. findCounter =", findCounter)
- log.Info("we can exit here")
- }
- if me.release.status.String() == "ALL DONE?" {
- log.Info("maybe ALL DONE?. findCounter =", findCounter)
- worked = true
- }
- log.Info("doRelease() failed. findCounter =", findCounter)
+ log.Info("doRelease() failed. findCounter =", findCounter, err)
worked = false
break
}