more attempts at release automation

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-24 02:41:34 -06:00
parent 9ddf46cf75
commit f2ad6d3138
5 changed files with 113 additions and 17 deletions

View File

@ -41,7 +41,7 @@ func globalDisplayOptions(box *gui.Node) {
}) })
*/ */
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(true) me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(false)
me.autoHidePerfect.Custom = func() { me.autoHidePerfect.Custom = func() {
if me.autoHidePerfect.Checked() { if me.autoHidePerfect.Checked() {
for repo, _ := range me.allrepos { for repo, _ := range me.allrepos {

View File

@ -59,6 +59,7 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion") newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion")
newRepo.dirtyLabel = grid.NewLabel("") newRepo.dirtyLabel = grid.NewLabel("")
newRepo.goSumStatus = grid.NewLabel("?")
newRepo.vLabel = grid.NewLabel("").SetProgName("current") newRepo.vLabel = grid.NewLabel("").SetProgName("current")
@ -111,7 +112,7 @@ func repoworld() {
} }
reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)") reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)")
reposgrid = reposgroup.NewGrid("test", 8, 1) reposgrid = reposgroup.NewGrid("test", 9, 1)
reposgrid.NewLabel("") // path goes here reposgrid.NewLabel("") // path goes here
@ -122,6 +123,7 @@ func repoworld() {
reposgrid.NewLabel("user version") reposgrid.NewLabel("user version")
reposgrid.NewLabel("Status") reposgrid.NewLabel("Status")
reposgrid.NewLabel("go.sum")
reposgrid.NewLabel("Current Version").SetProgName("Current Version") reposgrid.NewLabel("Current Version").SetProgName("Current Version")

View File

@ -20,6 +20,8 @@ type releaseStruct struct {
repo *gadgets.OneLiner repo *gadgets.OneLiner
status *gadgets.OneLiner status *gadgets.OneLiner
notes *gadgets.OneLiner notes *gadgets.OneLiner
version *gadgets.OneLiner
reason *gadgets.OneLiner
openrepo *gui.Node openrepo *gui.Node
} }
@ -42,6 +44,9 @@ func createReleaseWindow() {
release.group = release.box.NewGroup("things") release.group = release.box.NewGroup("things")
release.grid = release.group.NewGrid("buildOptions", 2, 1) release.grid = release.group.NewGrid("buildOptions", 2, 1)
// do an initial scan of all the repos
scanGoSum()
release.grid.NewButton("next repo", func() { release.grid.NewButton("next repo", func() {
log.Info("find the next repo to release here") log.Info("find the next repo to release here")
findNextRepo() findNextRepo()
@ -55,37 +60,76 @@ func createReleaseWindow() {
if release.current.status.CheckGoSum() { if release.current.status.CheckGoSum() {
log.Info("repo has go.sum requirements that are clean") log.Info("repo has go.sum requirements that are clean")
release.status.SetValue("CLEAN") release.status.SetValue("CLEAN")
release.current.goSumStatus.SetValue("CLEAN")
} else { } else {
log.Info("repo has go.sum requirements that are screwed up") log.Info("repo has go.sum requirements that are screwed up")
release.status.SetValue("BAD") release.status.SetValue("BAD")
release.current.goSumStatus.SetValue("BAD")
}
release.current.status.Update()
release.current.newScan()
if release.current.dirtyLabel.String() == "PERFECT" {
return
} }
// log.Info("find the next repo to release here") // log.Info("find the next repo to release here")
// release.current.status.Toggle() release.current.status.Toggle()
}) })
release.openrepo.Disable() release.openrepo.Disable()
release.repo = gadgets.NewOneLiner(release.grid, "repo") release.repo = gadgets.NewOneLiner(release.grid, "repo")
release.status = gadgets.NewOneLiner(release.grid, "status") release.status = gadgets.NewOneLiner(release.grid, "status")
release.notes = gadgets.NewOneLiner(release.grid, "notes") release.notes = gadgets.NewOneLiner(release.grid, "notes")
release.version = gadgets.NewOneLiner(release.grid, "version")
release.version.SetValue("0.13.11")
release.reason = gadgets.NewOneLiner(release.grid, "reason")
release.reason.SetValue("release automation")
release.grid.NewButton("send version", func() {
log.Info("set version()")
release.current.status.SetVersion("0", "13", "11", "release automation")
})
release.grid.NewButton("set ignore", func() {
tmp := release.current.goSumStatus.String()
log.Info("trying to set repo IGNORE is now =", tmp)
release.current.goSumStatus.SetValue("IGNORE")
release.current.goSumStatus.SetLabel("IGNORE")
release.current.goSumStatus.SetText("IGNORE")
})
} }
func findNextRepo() { func findNextRepo() {
for repo, _ := range me.allrepos { for repo, _ := range me.allrepos {
latestversion := repo.status.GetLastTagVersion() goSumS := repo.goSumStatus.String()
status := repo.dirtyLabel.String() dirtyS := repo.dirtyLabel.String()
if status == "PERFECT" {
log.Info("repo", repo.String(), goSumS, dirtyS)
if goSumS == "IGNORE" {
continue
}
// latestversion := repo.status.GetLastTagVersion()
if goSumS == "CLEAN" {
if dirtyS == "PERFECT" {
continue continue
} }
if repo.status.CheckDirty() {
log.Info("dirty repo:", latestversion, status, repo.status.String())
release.repo.SetValue(repo.status.String()) release.repo.SetValue(repo.status.String())
release.status.SetValue("dirty") release.status.SetValue("clean")
release.notes.SetValue("You must commit your changes\nbefore you can continue") release.notes.SetValue("check manually")
release.current = repo release.current = repo
release.openrepo.Enable() release.openrepo.Enable()
return return
} }
log.Info("repo:", latestversion, status, repo.status.String()) if goSumS == "DIRTY" {
release.repo.SetValue(repo.status.String())
release.status.SetValue("dirty")
release.notes.SetValue("commit changes")
release.current = repo
release.openrepo.Enable()
return
} }
} }
log.Info("tried to find() but not sure what to do next")
}

49
scan.go
View File

@ -73,3 +73,52 @@ func (r *repo) getStatus() string {
log.Warn("Branches are not Perfect") log.Warn("Branches are not Perfect")
return "merge" return "merge"
} }
func scanGoSum() {
for repo, _ := range me.allrepos {
latestversion := repo.status.GetLastTagVersion()
if repo.goSumStatus.String() == "BAD" {
continue
}
if repo.goSumStatus.String() == "DIRTY" {
continue
}
if repo.status.CheckDirty() {
log.Info("dirty repo:", latestversion, repo.status.String())
log.Info("dirty repo.goSumStatus =", repo.goSumStatus.String())
repo.goSumStatus.SetLabel("DIRTY")
// release.repo.SetValue(repo.status.String())
// release.status.SetValue("dirty")
// release.notes.SetValue("You must commit your changes\nbefore you can continue")
// release.current = repo
// release.openrepo.Enable()
continue
}
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("BAD")
// release.repo.SetValue(repo.status.String())
// release.status.SetValue("bad")
// release.notes.SetValue("the go.sum file is wrong")
// release.current = repo
// release.openrepo.Enable()
continue
}
status := repo.dirtyLabel.String()
if status == "PERFECT" {
continue
} else {
repo.status.Update()
repo.newScan()
}
// log.Info("find the next repo to release here")
log.Info("repo:", latestversion, status, repo.status.String())
}
log.Info("scan() did everything, not sure what to do next")
}

View File

@ -71,6 +71,7 @@ type repo struct {
lastTag *gui.Node // last tagged version label lastTag *gui.Node // last tagged version label
vLabel *gui.Node // version label vLabel *gui.Node // version label
dirtyLabel *gui.Node // git state (dirty or not?) dirtyLabel *gui.Node // git state (dirty or not?)
goSumStatus *gui.Node // what is the state of the go.sum file
// masterName *gui.Node // the master branch name // masterName *gui.Node // the master branch name
masterVersion *gui.Node // the master branch version masterVersion *gui.Node // the master branch version