From 2d981da765c0de80070fc776b2054034b9e2a8e4 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 11 Dec 2024 01:19:07 -0600 Subject: [PATCH] better checking --- doRelease.go | 17 +++++++++++++++-- findNext.go | 1 + http.go | 1 + releaseBox.go | 17 +++++++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/doRelease.go b/doRelease.go index 98fbc28..3f4c215 100644 --- a/doRelease.go +++ b/doRelease.go @@ -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()) diff --git a/findNext.go b/findNext.go index 84730eb..dbacc00 100644 --- a/findNext.go +++ b/findNext.go @@ -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 diff --git a/http.go b/http.go index 512394e..78e5365 100644 --- a/http.go +++ b/http.go @@ -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() diff --git a/releaseBox.go b/releaseBox.go index 5da083f..f62e9e2 100644 --- a/releaseBox.go +++ b/releaseBox.go @@ -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 {