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

View File

@ -10,6 +10,7 @@ import (
var findCounter int var findCounter int
var findFix bool = false var findFix bool = false
var findOk bool = true
// 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

View File

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

View File

@ -145,6 +145,10 @@ func createReleaseBox(box *gui.Node) {
ok, duration := doReleaseAll() ok, duration := doReleaseAll()
s := fmt.Sprint(duration) s := fmt.Sprint(duration)
log.Info("release returned", ok, "and ran for", s, "findCounter =", findCounter) 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 first := findCounter
if findCounter != 0 { if findCounter != 0 {
log.Info("should try thsi doRelease() loop again since findCounter =", findCounter) log.Info("should try thsi doRelease() loop again since findCounter =", findCounter)
@ -152,6 +156,10 @@ func createReleaseBox(box *gui.Node) {
s := fmt.Sprint(duration) s := fmt.Sprint(duration)
log.Info("release returned", ok, "and ran for", s, "findCounter =", findCounter) 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 second := findCounter
log.Info("doReleaseAll() first =", first, "second =", second) log.Info("doReleaseAll() first =", first, "second =", second)
if first == 0 { if first == 0 {
@ -169,6 +177,10 @@ func createReleaseBox(box *gui.Node) {
log.Info("release returned", ok, "and ran for", s, "findCounter =", findCounter) log.Info("release returned", ok, "and ran for", s, "findCounter =", findCounter)
third := findCounter third := findCounter
log.Info("doReleaseAll() first =", first, "second =", second, "third =", third) 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 { } else {
log.Info("doReleaseAll() first second match. something has gone terribly wrong") 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") 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() loop := me.repos.View.ReposSortByName()
for loop.Scan() { for loop.Scan() {
loop.Repo() loop.Repo()
if !findOk {
log.Info("doRelease() immediately end something went wrong last time. findOk == false")
worked = false
break
}
if doRelease() { if doRelease() {
log.Info("doRelease() worked. findCounter =", findCounter) log.Info("doRelease() worked. findCounter =", findCounter)
} else { } else {