better checking

This commit is contained in:
Jeff Carr 2024-12-11 01:19:07 -06:00
parent 20b3fa3520
commit 2d981da765
4 changed files with 34 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import (
"os"
"path/filepath"
"strings"
"time"
"github.com/go-cmd/cmd"
@ -14,6 +15,10 @@ import (
func doRelease() bool {
log.Info("doRelease() on", me.current.Name())
if !findOk {
log.Info("doRelease() immediately end something went wrong last time. findOk == false")
return false
}
// 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())
@ -90,14 +95,20 @@ func doRelease() bool {
if !me.current.Status.DoAll(all) {
log.Info("failed to make new release", me.release.version.String())
findOk = false
return false
}
log.Info("RELEASE OK")
// 'publish' the version to the golang package versioning system
if !doPublishVersion() {
log.Info("PUBLISH FAILED")
return false
time.Sleep(3 * time.Second)
// this can fail to update, try it again after sleep(3s)
if !doPublishVersion() {
log.Info("PUBLISH FAILED")
findOk = false
return false
}
}
pb := me.forge.Repos.FindByGoPath(me.current.GoPath())
@ -122,6 +133,7 @@ func doRelease() bool {
// to the development branch
if !me.current.Status.RevertMasterToDevel() {
log.Info("Revert Failed")
findOk = false
return false
}
@ -134,6 +146,7 @@ func doRelease() bool {
if !me.current.Status.DoAll(retag) {
log.Info("retag failed")
findOk = false
return false
}
log.Info("EVERYTHING OK. RERELEASED", me.current.Name())

View File

@ -10,6 +10,7 @@ import (
var findCounter int
var findFix bool = false
var findOk bool = true
// trys to figure out if there is still something to update
// todo: redo this logic as it is terrible

View File

@ -167,6 +167,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
}
// destroy and recreate the go.sum
fixGodeps(check)
findOk = true
return
case "/showNext":
showNext()

View File

@ -145,6 +145,10 @@ func createReleaseBox(box *gui.Node) {
ok, duration := doReleaseAll()
s := fmt.Sprint(duration)
log.Info("release returned", ok, "and ran for", s, "findCounter =", findCounter)
if !findOk {
log.Info("doRelease() immediately end something went wrong last time. findOk == false")
return
}
first := findCounter
if findCounter != 0 {
log.Info("should try thsi doRelease() loop again since findCounter =", findCounter)
@ -152,6 +156,10 @@ func createReleaseBox(box *gui.Node) {
s := fmt.Sprint(duration)
log.Info("release returned", ok, "and ran for", s, "findCounter =", findCounter)
}
if !findOk {
log.Info("doRelease() immediately end something went wrong last time. findOk == false")
return
}
second := findCounter
log.Info("doReleaseAll() first =", first, "second =", second)
if first == 0 {
@ -169,6 +177,10 @@ func createReleaseBox(box *gui.Node) {
log.Info("release returned", ok, "and ran for", s, "findCounter =", findCounter)
third := findCounter
log.Info("doReleaseAll() first =", first, "second =", second, "third =", third)
if !findOk {
log.Info("doRelease() immediately end something went wrong last time. findOk == false")
return
}
} else {
log.Info("doReleaseAll() first second match. something has gone terribly wrong")
log.Info("killing guireleaser is a bad idea here. it will potentially loose state")
@ -251,6 +263,11 @@ func doReleaseAll() (bool, time.Duration) {
loop := me.repos.View.ReposSortByName()
for loop.Scan() {
loop.Repo()
if !findOk {
log.Info("doRelease() immediately end something went wrong last time. findOk == false")
worked = false
break
}
if doRelease() {
log.Info("doRelease() worked. findCounter =", findCounter)
} else {