more things moved to gitpb
This commit is contained in:
parent
9e297f4603
commit
4e0a111c8c
22
doRelease.go
22
doRelease.go
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
func doRelease() bool {
|
||||
log.Info("doRelease() on", me.current.Name())
|
||||
log.Info("doRelease() on", me.current.GetGoPath())
|
||||
if !findOk {
|
||||
log.Info("doRelease() immediately end something went wrong last time. findOk == false")
|
||||
return false
|
||||
|
@ -41,8 +41,8 @@ func doRelease() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
curName := me.current.Status.GetCurrentBranchName()
|
||||
mName := me.current.Status.GetMasterBranchName()
|
||||
curName := me.current.GetCurrentBranchName()
|
||||
mName := me.current.GetMasterBranchName()
|
||||
if curName != mName {
|
||||
log.Info("\trepo is not working from main branch", curName, "!=", mName)
|
||||
return false
|
||||
|
@ -122,7 +122,7 @@ func doRelease() bool {
|
|||
badExit(errors.New(msg))
|
||||
}
|
||||
|
||||
if !me.current.Status.DoAll(all) {
|
||||
if !me.current.RunAll(all) {
|
||||
log.Info("failed to make new release", me.release.version.String())
|
||||
findOk = false
|
||||
return false
|
||||
|
@ -159,7 +159,7 @@ func doRelease() bool {
|
|||
|
||||
// unwind and re-tag. Now that the go.mod and go.sum are published, revert
|
||||
// to the development branch
|
||||
if !me.current.Status.RevertMasterToDevel() {
|
||||
if !me.current.RevertMasterToDevel() {
|
||||
log.Info("Revert Failed")
|
||||
findOk = false
|
||||
return false
|
||||
|
@ -179,12 +179,12 @@ func doRelease() bool {
|
|||
check.Run(cmd)
|
||||
}
|
||||
|
||||
if !me.current.Status.DoAll(retag) {
|
||||
if !me.current.RunAll(retag) {
|
||||
log.Info("retag failed")
|
||||
findOk = false
|
||||
return false
|
||||
}
|
||||
log.Info("EVERYTHING OK. RERELEASED", me.current.Name())
|
||||
log.Info("EVERYTHING OK. RERELEASED", me.current.GetGoPath())
|
||||
|
||||
// save autogen files under the tag version (for example: "v0.2.3")
|
||||
newtag := me.release.version.String()
|
||||
|
@ -200,7 +200,9 @@ func doRelease() bool {
|
|||
me.forge = forgepb.Init()
|
||||
|
||||
// update the values in the GUI
|
||||
me.current.NewScan()
|
||||
if repov := me.repos.View.FindByPath(check.GetGoPath()); repov != nil {
|
||||
repov.NewScan2(check)
|
||||
}
|
||||
|
||||
// attempt to find another repo to release
|
||||
if !doReleaseFindNext() {
|
||||
|
@ -211,7 +213,7 @@ func doRelease() bool {
|
|||
os.Setenv("FindNextDone", "true")
|
||||
return false
|
||||
}
|
||||
log.Info("GOOD TO RUN ANOTHER DAY ON:", me.current.Name())
|
||||
log.Info("GOOD TO RUN ANOTHER DAY ON:", me.current.GetGoPath())
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -252,7 +254,7 @@ func doPublishVersion() bool {
|
|||
docmd := []string{"go", "get", "-v", gopath + "@" + me.release.version.String()}
|
||||
log.Info("SHOULD RUN cmd HERE:", docmd)
|
||||
|
||||
if me.current.Status.IsPrivate() {
|
||||
if me.forge.Config.IsPrivate(me.current.GetGoPath()) {
|
||||
// do not self update private repos
|
||||
log.Info("This is a private repo and can not be self checked")
|
||||
return true
|
||||
|
|
28
findNext.go
28
findNext.go
|
@ -6,7 +6,6 @@ import (
|
|||
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/lib/gui/repolist"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
)
|
||||
|
||||
|
@ -19,14 +18,13 @@ var findOk bool = true
|
|||
// rename this findNext()
|
||||
func findNext() bool {
|
||||
findCounter = 0
|
||||
loop := me.repos.View.ReposSortByName()
|
||||
for loop.Scan() {
|
||||
repo := loop.Repo()
|
||||
all := me.forge.Repos.SortByFullPath()
|
||||
for all.Scan() {
|
||||
check := all.Next()
|
||||
|
||||
check := me.forge.FindByGoPath(repo.GetGoPath())
|
||||
if check == nil {
|
||||
log.Info("boo, you didn't git clone", repo.GetGoPath())
|
||||
return false
|
||||
if check.GetTargetVersion() == "" {
|
||||
// not set to upgrade
|
||||
continue
|
||||
}
|
||||
if check.GetLastTag() == check.GetTargetVersion() {
|
||||
// log.Info("findNext() no update needed", check.GetGoPath, check.GetTargetVersion(), "vs", check.GetCurrentBranchVersion())
|
||||
|
@ -73,7 +71,7 @@ func findNext() bool {
|
|||
log.Info("go.mod is gone here")
|
||||
}
|
||||
if me.forge.FinalGoDepsCheckOk(check) {
|
||||
setCurrentRepo(repo, "should be good to release", "pretty sure")
|
||||
setCurrentRepo(check, "should be good to release", "pretty sure")
|
||||
if check.Exists("go.mod") {
|
||||
log.Info("go.mod exists here")
|
||||
} else {
|
||||
|
@ -86,7 +84,7 @@ func findNext() bool {
|
|||
} else {
|
||||
log.Info("go.mod is gone here")
|
||||
}
|
||||
log.Info("findNext() got to the end. repo", repo.GetGoPath(), "did not work. trying to find a new one now")
|
||||
log.Info("findNext() got to the end. repo", check.GetGoPath(), "did not work. trying to find a new one now")
|
||||
}
|
||||
if findCounter == 0 {
|
||||
log.Info("NOTHING TO UPDATE. findCounter =", findCounter)
|
||||
|
@ -166,17 +164,11 @@ func fixGodeps(check *gitpb.Repo) bool {
|
|||
return good
|
||||
}
|
||||
|
||||
func setCurrentRepo(repo *repolist.RepoRow, s string, note string) bool {
|
||||
check := me.forge.FindByGoPath(repo.GetGoPath())
|
||||
if check == nil {
|
||||
log.Info("boo, you didn't git clone", repo.GetGoPath())
|
||||
return false
|
||||
}
|
||||
|
||||
func setCurrentRepo(check *gitpb.Repo, s string, note string) bool {
|
||||
me.release.repo.SetText(check.GetGoPath())
|
||||
me.release.status.SetText(s)
|
||||
me.release.notes.SetText(note)
|
||||
me.current = repo
|
||||
me.current = check
|
||||
me.release.version.SetText(check.GetTargetVersion())
|
||||
me.release.releaseVersionB.SetText("release version " + check.GetTargetVersion())
|
||||
me.release.openrepo.Enable()
|
||||
|
|
26
http.go
26
http.go
|
@ -75,8 +75,8 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
log.Info(me.current.StandardHeader())
|
||||
log.Info(me.current.StandardReleaseHeader())
|
||||
// log.Info(me.current.StandardHeader())
|
||||
log.Info(me.forge.StandardReleaseHeader(me.current, "todoing"))
|
||||
case "/rescanAll":
|
||||
me.repos.View.ScanRepositories()
|
||||
case "/setCurrentRepo":
|
||||
|
@ -85,7 +85,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
log.Info("version: " + version)
|
||||
log.Info("comment: " + comment)
|
||||
|
||||
repo := me.repos.View.FindByName(repoName)
|
||||
repo := me.forge.FindByGoPath(repoName)
|
||||
if repo == nil {
|
||||
log.Info("FindRepoByName() returned nil")
|
||||
return
|
||||
|
@ -95,12 +95,12 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
case "/IncrementRevisonVersion":
|
||||
log.Info("repo: " + repoName)
|
||||
log.Info("version: " + version)
|
||||
me.current.Status.IncrementRevisionVersion(comment)
|
||||
me.current.IncrementTargetRevision()
|
||||
case "/IncrementMinorVersion":
|
||||
log.Info("repo: " + repoName)
|
||||
log.Info("version: " + version)
|
||||
|
||||
me.current.Status.IncrementMinorVersion("trying minor")
|
||||
me.current.IncrementTargetMinor()
|
||||
case "/setAllBranchesToMaster":
|
||||
log.Info("set all branches to master")
|
||||
me.Disable()
|
||||
|
@ -128,7 +128,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
log.Info("me.current == nil")
|
||||
return
|
||||
}
|
||||
me.current.Status.SetTargetVersion(version)
|
||||
me.current.SetTargetVersion(version)
|
||||
return
|
||||
case "/setAllTargetVersions":
|
||||
log.Info("version: " + version)
|
||||
|
@ -263,7 +263,10 @@ func showNext() {
|
|||
return
|
||||
}
|
||||
|
||||
if me.current.Status.IsReleased() {
|
||||
if me.current.GetTargetVersion() == "" {
|
||||
log.Info("TargetVersion == blank")
|
||||
}
|
||||
if me.current.GetTargetVersion() == me.current.GetCurrentVersion() {
|
||||
log.Info("IsReleased() == true. do not release this a second time")
|
||||
} else {
|
||||
log.Info("IsReleased() == false")
|
||||
|
@ -298,18 +301,11 @@ func showNext() {
|
|||
log.Info(log.Sprint("IsProtobuf() == err", err))
|
||||
}
|
||||
}
|
||||
if me.current.Status.Whitelist {
|
||||
log.Info("Whitelist == true SHOULD NOT RELEASE THIS")
|
||||
} else {
|
||||
log.Info("Whitelist == false")
|
||||
}
|
||||
log.Info("")
|
||||
|
||||
testNext()
|
||||
|
||||
log.Info(repolist.ReportHeader())
|
||||
log.Info(me.current.StandardHeader())
|
||||
log.Info("")
|
||||
log.Info(repolist.ReleaseReportHeader())
|
||||
log.Info(me.current.StandardReleaseHeader())
|
||||
log.Info(me.forge.StandardReleaseHeader(me.current, "notsure"))
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.wit.com/gui"
|
||||
|
@ -71,7 +70,9 @@ func createReleaseBox(box *gui.Node) {
|
|||
|
||||
me.release.repo = gadgets.NewOneLiner(me.release.grid, "repo")
|
||||
me.release.openrepo = me.release.grid.NewButton("Configure", func() {
|
||||
me.current.Status.Toggle()
|
||||
if repov := me.repos.View.FindByPath(me.current.GetGoPath()); repov != nil {
|
||||
repov.Status.Toggle()
|
||||
}
|
||||
})
|
||||
me.release.openrepo.Disable()
|
||||
me.release.grid.NextRow()
|
||||
|
@ -104,8 +105,10 @@ func createReleaseBox(box *gui.Node) {
|
|||
|
||||
grid.NewButton("whitelist", func() {
|
||||
// tmp := me.current.GoState()
|
||||
if repov := me.repos.View.FindByPath(me.current.GetGoPath()); repov != nil {
|
||||
log.Info("trying to whitelist repo", me.current.GetGoPath())
|
||||
me.current.Status.Whitelist = true
|
||||
repov.Status.Whitelist = true
|
||||
}
|
||||
findNext()
|
||||
})
|
||||
|
||||
|
@ -191,51 +194,6 @@ func createReleaseBox(box *gui.Node) {
|
|||
}
|
||||
})
|
||||
grid.NextRow()
|
||||
|
||||
grid.NewButton("git ls-files |grep go.mod", func() {
|
||||
loop := me.repos.View.ReposSortByName()
|
||||
for loop.Scan() {
|
||||
repo := loop.Repo()
|
||||
log.Info("repo:", repo.Name())
|
||||
if repo.Status.ReadOnly() {
|
||||
continue
|
||||
}
|
||||
if repo.Status.Whitelist {
|
||||
log.Warn("skipping whitelist", repo.GetGoPath())
|
||||
continue
|
||||
}
|
||||
good, files := repo.Status.GitLsFiles()
|
||||
if !good {
|
||||
log.Warn("Something went wrong", repo.GetGoPath())
|
||||
continue
|
||||
}
|
||||
for _, filename := range strings.Split(files, "\n") {
|
||||
log.Info("\tfile", filename)
|
||||
if filename == "go.mod" {
|
||||
log.Info("Found go.mod. does version match release version?")
|
||||
log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
|
||||
if repo.Status.GetLastTagVersion() != repo.Status.GetTargetVersion() {
|
||||
log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
|
||||
log.Info("Found go.sum. version mismatch")
|
||||
setCurrentRepo(repo, "VERY BROKEN", "rewind go.mod commit")
|
||||
return
|
||||
}
|
||||
}
|
||||
if filename == "go.sum" {
|
||||
log.Info("Found go.sum. does version match release version?")
|
||||
log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
|
||||
if repo.Status.GetLastTagVersion() != repo.Status.GetTargetVersion() {
|
||||
log.Info(repo.Status.GetLastTagVersion(), "vs", repo.Status.GetTargetVersion())
|
||||
log.Info("Found go.sum. version mismatch")
|
||||
setCurrentRepo(repo, "VERY BROKEN", "rewind go.mod commit")
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
log.Info("All repos seem okay")
|
||||
})
|
||||
grid.NextRow()
|
||||
}
|
||||
|
||||
func doReleaseAll() (bool, time.Duration) {
|
||||
|
|
|
@ -4,7 +4,6 @@ package main
|
|||
import (
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/repolist"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
)
|
||||
|
@ -19,7 +18,7 @@ type autoType struct {
|
|||
reposbox *gui.Node
|
||||
reposgrid *gui.Node
|
||||
reposgroup *gui.Node
|
||||
current *repolist.RepoRow
|
||||
current *gitpb.Repo
|
||||
|
||||
// this is the repo we are starting in
|
||||
// make sure it never changes so go.mod and go.sum are always there
|
||||
|
|
Loading…
Reference in New Issue