attempt to release versions

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-24 16:25:41 -06:00
parent f2ad6d3138
commit 4735d37b3c
3 changed files with 171 additions and 2 deletions

View File

@ -145,4 +145,5 @@ func repoworld() {
}
addRepo(reposgrid, path, mbranch, dbranch, ubranch)
}
reposwin.Toggle()
}

View File

@ -24,6 +24,12 @@ type releaseStruct struct {
reason *gadgets.OneLiner
openrepo *gui.Node
goGetB *gui.Node
checkGoSumB *gui.Node
checkDirtyB *gui.Node
makeRedomodB *gui.Node
sendVersionB *gui.Node
}
func createReleaseWindow() {
@ -49,7 +55,11 @@ func createReleaseWindow() {
release.grid.NewButton("next repo", func() {
log.Info("find the next repo to release here")
if findNextDirty() {
log.Info("found a dirty repo")
} else {
findNextRepo()
}
})
release.openrepo = release.grid.NewButton("open repo", func() {
@ -88,7 +98,7 @@ func createReleaseWindow() {
release.reason = gadgets.NewOneLiner(release.grid, "reason")
release.reason.SetValue("release automation")
release.grid.NewButton("send version", func() {
release.sendVersionB = release.grid.NewButton("send version", func() {
log.Info("set version()")
release.current.status.SetVersion("0", "13", "11", "release automation")
})
@ -99,6 +109,134 @@ func createReleaseWindow() {
release.current.goSumStatus.SetLabel("IGNORE")
release.current.goSumStatus.SetText("IGNORE")
})
release.checkDirtyB = release.grid.NewButton("CheckDirty()", func() {
buttonDisable()
if release.current.status.CheckDirty() {
log.Info("repo is dirty")
} else {
log.Info("repo is not dirty")
}
buttonEnable()
})
release.checkGoSumB = release.grid.NewButton("CheckGoSum()", func() {
buttonDisable()
tmp := release.current.String()
log.Info("Run CheckGoSum on repo:", tmp)
if release.current.status.CheckGoSum() {
log.Info("repo has go.sum requirements that are clean")
release.current.goSumStatus.SetValue("CLEAN")
release.current.goSumStatus.SetLabel("CLEAN")
release.current.goSumStatus.SetText("CLEAN")
} else {
log.Info("repo has go.sum requirements that are screwed up")
if release.current.goSumStatus.String() == "BAD" {
release.current.goSumStatus.SetLabel("BAD VERSION")
release.current.goSumStatus.SetText("BAD VERSION")
}
}
buttonEnable()
})
release.grid.NewButton("CheckPrimativeGoMod()", func() {
tmp := release.current.String()
log.Info("Run CheckGoSum on repo:", tmp)
if release.current.status.CheckPrimativeGoMod() {
log.Info("repo has PRIMATIVE go.mod")
} else {
log.Info("repo go.mod requies checking for a go.sum")
}
})
release.grid.NewButton("reset with scanGoSum()", func() {
buttonDisable()
// do an initial scan of all the repos
scanGoSum()
buttonEnable()
})
release.makeRedomodB = release.grid.NewButton("make redomod", func() {
buttonDisable()
release.current.status.MakeRedomod()
buttonEnable()
})
release.goGetB = release.grid.NewButton("go get -v -u .", func() {
buttonDisable()
err, output := release.current.status.RunCmd([]string{"go", "get", "-v", "-u", "."})
log.Warn(output)
if err == nil {
log.Warn("go get worked. recheck go.sum")
} else {
log.Warn("go get failed")
}
buttonEnable()
})
}
func buttonDisable() {
release.goGetB.Disable()
release.makeRedomodB.Disable()
release.checkGoSumB.Disable()
release.openrepo.Disable()
release.checkDirtyB.Disable()
release.sendVersionB.Disable()
}
func buttonEnable() {
release.goGetB.Enable()
release.makeRedomodB.Enable()
release.checkGoSumB.Enable()
release.openrepo.Enable()
release.checkDirtyB.Enable()
release.sendVersionB.Enable()
}
func findNextDirty() bool {
for repo, _ := range me.allrepos {
goSumS := repo.goSumStatus.String()
dirtyS := repo.dirtyLabel.String()
log.Info("repo", repo.String(), goSumS, dirtyS)
if goSumS == "PRIMATIVE" {
continue
}
if goSumS == "IGNORE" {
continue
}
if goSumS == "DIRTY 2" {
continue
}
// latestversion := repo.status.GetLastTagVersion()
if goSumS == "CLEAN" {
if dirtyS == "PERFECT" {
continue
}
release.repo.SetValue(repo.status.String())
release.status.SetValue("clean")
release.notes.SetValue("check manually")
release.current = repo
release.openrepo.Enable()
return true
}
if goSumS == "DIRTY" {
if repo.status.CheckGoSum() {
log.Info("repo has go.sum requirements that are clean")
// repo.goSumStatus.SetLabel("CLEAN")
} else {
log.Info("repo has go.sum requirements that are screwed up")
repo.goSumStatus.SetLabel("DIRTY 2")
continue
}
// release.repo.SetValue(repo.status.String())
// release.status.SetValue("bad")
release.repo.SetValue(repo.status.String())
release.status.SetValue("dirty")
release.notes.SetValue("commit changes")
release.current = repo
release.openrepo.Enable()
return true
}
}
log.Info("tried to find() but not sure what to do next")
return false
}
func findNextRepo() {
@ -110,6 +248,12 @@ func findNextRepo() {
if goSumS == "IGNORE" {
continue
}
if goSumS == "DIRTY 2" {
continue
}
if goSumS == "BAD VERSION" {
continue
}
// latestversion := repo.status.GetLastTagVersion()
if goSumS == "CLEAN" {
if dirtyS == "PERFECT" {
@ -123,6 +267,17 @@ func findNextRepo() {
return
}
if goSumS == "DIRTY" {
if repo.status.CheckGoSum() {
log.Info("repo has go.sum requirements that are clean")
// repo.goSumStatus.SetLabel("CLEAN")
} else {
log.Info("repo has go.sum requirements that are screwed up")
repo.goSumStatus.SetLabel("DIRTY 2")
continue
}
// release.repo.SetValue(repo.status.String())
// release.status.SetValue("bad")
release.repo.SetValue(repo.status.String())
release.status.SetValue("dirty")
release.notes.SetValue("commit changes")
@ -130,6 +285,14 @@ func findNextRepo() {
release.openrepo.Enable()
return
}
if goSumS == "BAD" {
release.repo.SetValue(repo.status.String())
release.status.SetValue("bad")
release.notes.SetValue("redo go.sum")
release.current = repo
release.openrepo.Enable()
return
}
}
log.Info("tried to find() but not sure what to do next")
}

View File

@ -83,6 +83,11 @@ func scanGoSum() {
if repo.goSumStatus.String() == "DIRTY" {
continue
}
if repo.status.CheckPrimativeGoMod() {
log.Info("PRIMATIVE repo:", latestversion, repo.status.String())
repo.goSumStatus.SetLabel("PRIMATIVE")
continue
}
if repo.status.CheckDirty() {
log.Info("dirty repo:", latestversion, repo.status.String())
log.Info("dirty repo.goSumStatus =", repo.goSumStatus.String())