redo the release tag after publish
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
f408a756f9
commit
cae327e162
98
doRelease.go
98
doRelease.go
|
@ -9,6 +9,8 @@ import (
|
|||
)
|
||||
|
||||
func doRelease() bool {
|
||||
log.Info("doRelease() on", release.current.String())
|
||||
// double check release version logic
|
||||
if release.releaseVersionB.String() != "release version "+release.version.String() {
|
||||
log.Warn("something went wrong with the release.version:", release.version.String())
|
||||
return false
|
||||
|
@ -26,6 +28,7 @@ func doRelease() bool {
|
|||
log.Warn("GOOD. lots of go.sum checks passed", release.version.String())
|
||||
case "manually chosen":
|
||||
log.Warn("attempting manual release", release.version.String())
|
||||
/*
|
||||
case "NOT READY":
|
||||
log.Warn("attempting to release. TODO: recheck go.sum here", release.version.String())
|
||||
log.Warn("Sleep 10")
|
||||
|
@ -34,6 +37,7 @@ func doRelease() bool {
|
|||
log.Warn("attempting to release. TODO: dig deep on go.sum here", release.version.String())
|
||||
log.Warn("Sleep 10")
|
||||
log.Sleep(10)
|
||||
*/
|
||||
default:
|
||||
log.Warn("what is this?", release.version.String(), release.status.String())
|
||||
return false
|
||||
|
@ -69,38 +73,61 @@ func doRelease() bool {
|
|||
all = append(all, []string{"git", "tag", "-m", me.releaseReasonS, release.version.String()})
|
||||
all = append(all, []string{"git", "push", "origin", release.version.String()})
|
||||
|
||||
if doAll(release.current, all) {
|
||||
log.Info("EVERYTHING OK")
|
||||
|
||||
gopath := release.current.String()
|
||||
cmd := []string{"go", "get", "-v", gopath + "@" + release.version.String()}
|
||||
log.Info("SHOULD RUN cmd HERE:", cmd)
|
||||
|
||||
if release.guireleaser == nil {
|
||||
log.Info("CAN NOT SELF UPDATE HERE. cmd =", cmd)
|
||||
if !release.current.status.DoAll(all) {
|
||||
log.Info("failed to make new release", release.version.String())
|
||||
return false
|
||||
} else {
|
||||
os.Unsetenv("GO111MODULE")
|
||||
log.Info("TRYING TO SELF UPDATE HERE. cmd =", cmd)
|
||||
err, out := release.guireleaser.status.RunCmd(cmd)
|
||||
if gopath == "go.wit.com/apps/guireleaser" {
|
||||
// ignore errors on updating myself
|
||||
log.Info("IGNORE SELF UPDATE ERROR. cmd =", cmd)
|
||||
err = nil
|
||||
}
|
||||
if err == nil {
|
||||
log.Info("SELF UPDATE OK. out =", out)
|
||||
log.Info("SELF UPDATE WORKED")
|
||||
log.Info("RELEASE OK")
|
||||
|
||||
// 'publish' the version to the golang package versioning system
|
||||
if !doPublishVersion() {
|
||||
log.Info("PUBLISH FAILED")
|
||||
return false
|
||||
}
|
||||
|
||||
log.Info("PUBLISH OK")
|
||||
release.current.setGoSumStatus("RELEASED")
|
||||
|
||||
// unwind and re-tag. Now that the go.mod and go.sum are published, revert
|
||||
// to the development branch
|
||||
if ! release.current.status.RevertMasterToDevel() {
|
||||
log.Info("Revert Failed")
|
||||
return false
|
||||
}
|
||||
|
||||
// update tag
|
||||
var retag [][]string
|
||||
retag = append(retag, []string{"git", "tag", "--delete", release.version.String()})
|
||||
retag = append(retag, []string{"git", "push", "--delete", "origin", release.version.String()})
|
||||
retag = append(retag, []string{"git", "tag", "-m", me.releaseReasonS, release.version.String()})
|
||||
retag = append(retag, []string{"git", "push", "origin", release.version.String()})
|
||||
|
||||
if !release.current.status.DoAll(retag) {
|
||||
log.Info("retag failed")
|
||||
return false
|
||||
}
|
||||
log.Info("EVERYTHING OK. RERELEASED", release.current.String())
|
||||
|
||||
// update the package versions used for checking go.sum validity
|
||||
release.current.status.UpdateCurrent()
|
||||
// repo.newScan()
|
||||
cbname := release.current.status.GetCurrentBranchName()
|
||||
cbversion := release.current.status.GetCurrentBranchVersion()
|
||||
lasttag := release.current.status.GetLastTagVersion()
|
||||
// update the values in the GUI
|
||||
release.current.lastTag.SetLabel(lasttag)
|
||||
release.current.vLabel.SetLabel(cbname + " " + cbversion)
|
||||
|
||||
// attempt to find another repo to release
|
||||
if ! doReleaseFindNext() {
|
||||
log.Info("doReleaseFindNext() could not find a new")
|
||||
return false
|
||||
}
|
||||
log.Info("GOOD TO RUN ANOTHER DAY ON:", release.current.String())
|
||||
return true
|
||||
}
|
||||
|
||||
// try to figure out if there is another package to update
|
||||
func doReleaseFindNext() bool {
|
||||
// scan for new repo
|
||||
if findNextDirty("") {
|
||||
log.Info("findNextDirty() found something")
|
||||
|
@ -121,16 +148,35 @@ func doRelease() bool {
|
|||
release.status.SetValue("GOOD")
|
||||
release.notes.SetValue("CheckGoSum() does not seem to lie")
|
||||
return true
|
||||
} else {
|
||||
}
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
log.Info("SELF UPDATE FAILED err =", err)
|
||||
log.Info("SELF UPDATE FAILED out =", out)
|
||||
|
||||
// this pulls the new tag from the golang package repository
|
||||
// to insert the new version
|
||||
func doPublishVersion() bool {
|
||||
gopath := release.current.String()
|
||||
cmd := []string{"go", "get", "-v", gopath + "@" + release.version.String()}
|
||||
log.Info("SHOULD RUN cmd HERE:", cmd)
|
||||
|
||||
// right now, you can't publish this because the go.* files in this project are screwed up
|
||||
if release.guireleaser == nil {
|
||||
log.Info("CAN NOT SELF UPDATE HERE. cmd =", cmd)
|
||||
return false
|
||||
}
|
||||
os.Unsetenv("GO111MODULE")
|
||||
log.Info("TRYING TO SELF UPDATE HERE. cmd =", cmd)
|
||||
err, out := release.guireleaser.status.RunCmd(cmd)
|
||||
if gopath == "go.wit.com/apps/guireleaser" {
|
||||
// ignore errors on updating myself
|
||||
log.Info("IGNORE SELF UPDATE ERROR. cmd =", cmd)
|
||||
err = nil
|
||||
}
|
||||
if err == nil {
|
||||
log.Info("SELF UPDATE OK. out =", out)
|
||||
log.Info("SELF UPDATE WORKED")
|
||||
release.current.setGoSumStatus("RELEASED")
|
||||
return true
|
||||
}
|
||||
log.Info("doAll() failed")
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ func globalDisplayOptions(box *gui.Node) {
|
|||
if reposwin.Hidden() {
|
||||
log.Info("showing reposwin")
|
||||
showHideRepos()
|
||||
// have to run this twice for now
|
||||
scanForReady()
|
||||
scanForReady()
|
||||
reposwin.Show()
|
||||
|
|
143
releaseWindow.go
143
releaseWindow.go
|
@ -97,40 +97,7 @@ func createReleaseBox(box *gui.Node) {
|
|||
})
|
||||
|
||||
release.openrepo = release.grid.NewButton("open repo", func() {
|
||||
if release.current == nil {
|
||||
log.Info("find the next repo first")
|
||||
return
|
||||
}
|
||||
// make sure read only is set
|
||||
if release.current.status.ReadOnly() {
|
||||
release.readOnly.SetValue("true")
|
||||
} else {
|
||||
release.readOnly.SetValue("false")
|
||||
}
|
||||
|
||||
// do a new scan
|
||||
release.current.newScan()
|
||||
|
||||
// only continue if the go.sum & go.mod files are clean
|
||||
if ok, missing := release.current.status.CheckGoSum(); ok {
|
||||
log.Info("repo has go.sum requirements that are clean")
|
||||
release.status.SetValue("CLEAN")
|
||||
release.current.setGoSumStatus("CLEAN")
|
||||
} else {
|
||||
log.Info("BAD repo has go.sum requirements that are screwed up. missing:", missing)
|
||||
release.status.SetValue("BAD")
|
||||
release.current.setGoSumStatus("BAD")
|
||||
return
|
||||
}
|
||||
|
||||
if release.current.dirtyLabel.String() == "PERFECT" {
|
||||
log.Info("REPO IS STILL DIRTY")
|
||||
return
|
||||
}
|
||||
|
||||
// open the status window to commit the release
|
||||
release.current.status.Toggle()
|
||||
release.current.status.UpdateCurrent()
|
||||
})
|
||||
release.openrepo.Disable()
|
||||
|
||||
|
@ -206,19 +173,6 @@ func createReleaseBox(box *gui.Node) {
|
|||
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.makeRedomodB = release.grid.NewButton("make redomod", func() {
|
||||
buttonDisable()
|
||||
if release.current.status.MakeRedomod() {
|
||||
|
@ -282,8 +236,6 @@ func fullDoubleCheckFix() bool {
|
|||
func goodCheckGoSum() bool {
|
||||
tmp := release.current.String()
|
||||
log.Info("goodCheckGoSum() START on repo:", tmp, "STATUS =", release.current.getGoSumStatus())
|
||||
/*
|
||||
*/
|
||||
|
||||
var maybe bool = true
|
||||
goConfig := release.current.status.GetGoDeps()
|
||||
|
@ -335,30 +287,6 @@ func buttonEnable() {
|
|||
me.Enable()
|
||||
}
|
||||
|
||||
func findDirty2() bool {
|
||||
log.Info("findDirty2() START")
|
||||
for _, repo := range me.allrepos {
|
||||
goSumS := repo.getGoSumStatus()
|
||||
dirtyS := repo.dirtyLabel.String()
|
||||
|
||||
if goSumS == "IGNORE" {
|
||||
continue
|
||||
}
|
||||
|
||||
if goSumS == "DIRTY 2" {
|
||||
log.Info("repo DIRTY 2", repo.String(), goSumS, dirtyS)
|
||||
if setCurrentRepo(repo, "dirty 2", "check manually I guess") {
|
||||
return true
|
||||
}
|
||||
return true
|
||||
} else {
|
||||
log.Info("repo not DIRTY 2", repo.String(), goSumS, dirtyS)
|
||||
}
|
||||
}
|
||||
log.Info("findDirty2() END")
|
||||
return false
|
||||
}
|
||||
|
||||
func setCurrentRepo(newcur *repo, s string, note string) bool {
|
||||
if newcur.status.ReadOnly() {
|
||||
return false
|
||||
|
@ -373,13 +301,6 @@ func setCurrentRepo(newcur *repo, s string, note string) bool {
|
|||
release.unreleaseB.SetText("un-release version " + release.current.targetVersion.String())
|
||||
release.openrepo.Enable()
|
||||
|
||||
/*
|
||||
if newcur.status.ReadOnly() {
|
||||
release.readOnly.SetValue("true ro")
|
||||
} else {
|
||||
release.readOnly.SetValue("false ro")
|
||||
}
|
||||
*/
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -510,67 +431,3 @@ func findNextDirty(onlyKind string) bool {
|
|||
release.status.SetValue("ALL DONE?")
|
||||
return false
|
||||
}
|
||||
|
||||
func findNextRepo() bool {
|
||||
for _, repo := range me.allrepos {
|
||||
goSumS := repo.getGoSumStatus()
|
||||
dirtyS := repo.dirtyLabel.String()
|
||||
|
||||
log.Info("findNextRepo()", repo.String(), goSumS, dirtyS)
|
||||
if goSumS == "IGNORE" {
|
||||
continue
|
||||
}
|
||||
if goSumS == "DIRTY 2" {
|
||||
continue
|
||||
}
|
||||
if goSumS == "BAD VERSION" {
|
||||
continue
|
||||
}
|
||||
if goSumS == "BAD DEP" {
|
||||
// find out what kind of BAD DEP?
|
||||
continue
|
||||
}
|
||||
// latestversion := repo.status.GetLastTagVersion()
|
||||
if goSumS == "CLEAN" {
|
||||
// if it's clean here, then check and remake the go.sum file
|
||||
// then stop to commit the release version
|
||||
repo.checkSafeGoSumRemake()
|
||||
if repo.checkDirty() {
|
||||
dirtyS = repo.dirtyLabel.String()
|
||||
}
|
||||
if dirtyS == "PERFECT" {
|
||||
continue
|
||||
}
|
||||
if setCurrentRepo(repo, "clean round 2", "check manually") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if goSumS == "DIRTY" {
|
||||
if ok, missing := repo.status.CheckGoSum(); ok {
|
||||
log.Info("repo has go.sum requirements that are clean")
|
||||
// repo.setGoSumStatus("CLEAN")
|
||||
} else {
|
||||
log.Info("DIRTY 3 repo has go.sum requirements that are screwed up. missing:", missing)
|
||||
repo.setGoSumStatus("DIRTY 3")
|
||||
continue
|
||||
}
|
||||
|
||||
if setCurrentRepo(repo, "dirty", "commit changes") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if goSumS == "BAD" {
|
||||
// if it's clean here, then check and remake the go.sum file
|
||||
// then stop to commit the release version
|
||||
repo.checkSafeGoSumRemake()
|
||||
if repo.checkDirty() {
|
||||
dirtyS = repo.dirtyLabel.String()
|
||||
}
|
||||
if setCurrentRepo(repo, "bad", "redo go.sum") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
log.Info("tried to findNextRepo() but not sure what to do next")
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue