almost automated again
This commit is contained in:
parent
e9ecf2ed7e
commit
c8fdd11ab6
3
Makefile
3
Makefile
|
@ -51,6 +51,9 @@ curl-setBranchesToMasterB:
|
|||
findNext:
|
||||
curl --silent http://localhost:9419/findNext
|
||||
|
||||
fixNext:
|
||||
curl --silent http://localhost:9419/fixNext
|
||||
|
||||
showNext:
|
||||
curl --silent http://localhost:9419/showNext
|
||||
|
||||
|
|
|
@ -161,6 +161,11 @@ func doReleaseFindNext() bool {
|
|||
if findNext() {
|
||||
log.Info("findNext() found something")
|
||||
} else {
|
||||
// this means findNext() didn't find anything but there are
|
||||
// still packages to release. start trying to fix the go.sum files
|
||||
if findCounter != 0 {
|
||||
findFix = true
|
||||
}
|
||||
log.Info("findNext() could not find anything")
|
||||
return false
|
||||
}
|
||||
|
@ -169,6 +174,9 @@ func doReleaseFindNext() bool {
|
|||
log.Info("boo, you didn't git clone", me.current.GoPath())
|
||||
return false
|
||||
}
|
||||
if findFix {
|
||||
fixGodeps(me.current)
|
||||
}
|
||||
if me.forge.FinalGoDepsCheckOk(check) {
|
||||
// the go.sum file is ok to release
|
||||
return true
|
||||
|
|
18
findNext.go
18
findNext.go
|
@ -9,10 +9,14 @@ import (
|
|||
"go.wit.com/lib/gui/repolist"
|
||||
)
|
||||
|
||||
var findCounter int
|
||||
var findFix bool = false
|
||||
|
||||
// trys to figure out if there is still something to update
|
||||
// todo: redo this logic as it is terrible
|
||||
// rename this findNext()
|
||||
func findNext() bool {
|
||||
findCounter = 0
|
||||
loop := me.repos.View.ReposSortByName()
|
||||
for loop.Scan() {
|
||||
repo := loop.Repo()
|
||||
|
@ -46,12 +50,24 @@ func findNext() bool {
|
|||
log.Info("boo, you didn't git clone", repo.GoPath())
|
||||
return false
|
||||
}
|
||||
if findFix {
|
||||
fixGodeps(repo)
|
||||
}
|
||||
findCounter += 1
|
||||
if me.forge.FinalGoDepsCheckOk(check) {
|
||||
setCurrentRepo(repo, "should be good to release", "pretty sure")
|
||||
return true
|
||||
}
|
||||
}
|
||||
log.Info("tried to findNext() but not sure what to do next")
|
||||
if me.current == nil {
|
||||
if findCounter == 0 {
|
||||
log.Info("NOTHING TO UPDATE. findCounter =", findCounter)
|
||||
} else {
|
||||
findFix = true
|
||||
log.Info("me.current is nil findCounter =", findCounter, "so set findFix =", findFix)
|
||||
}
|
||||
}
|
||||
log.Info("tried to findNext() but not sure what to do next counter =", findCounter, "findFix =", findFix)
|
||||
me.release.status.SetText("ALL DONE?")
|
||||
return false
|
||||
}
|
||||
|
|
125
http.go
125
http.go
|
@ -156,6 +156,74 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
repo.Status.Whitelist = true
|
||||
}
|
||||
case "/testNext":
|
||||
testNext()
|
||||
return
|
||||
case "/fixNext":
|
||||
// destroy and recreate the go.sum
|
||||
fixGodeps(me.current)
|
||||
return
|
||||
case "/showNext":
|
||||
showNext()
|
||||
return
|
||||
case "/list":
|
||||
PrintReport(readonly, onlydirty, perfect)
|
||||
return
|
||||
case "/releaseList":
|
||||
PrintReleaseReport(readonly, perfect)
|
||||
return
|
||||
case "/quit":
|
||||
log.Info("Got URL /quit")
|
||||
os.Exit(0)
|
||||
return
|
||||
case "/goweblist":
|
||||
loop := me.repos.View.ReposAll()
|
||||
for loop.Scan() {
|
||||
repo := loop.Repo()
|
||||
|
||||
lastTag := repo.LastTag()
|
||||
tag := repo.Status.NewestTag()
|
||||
gitAge, err := tag.GetDate()
|
||||
if err != nil {
|
||||
log.Info(fmt.Sprintf("tag date error", repo.Name()))
|
||||
}
|
||||
// if lastTag == "" {
|
||||
// lastTag = tag.Name()
|
||||
// }
|
||||
if repo.ReadOnly() {
|
||||
if readonly == "true" {
|
||||
continue
|
||||
}
|
||||
}
|
||||
// dur := time.Since(gitAge)
|
||||
// log.Info(fmt.Sprintf("%-60s %s %s %s", repo.Name(), lastTag, shell.FormatDuration(dur), lastTag, tag.Name()))
|
||||
log.Info(fmt.Sprintf("%s %d %s", repo.Name(), gitAge.Unix(), lastTag))
|
||||
/*
|
||||
for _, tag := range repo.Tags.ListAll() {
|
||||
log.Info(fmt.Sprintf("%-60s %s", "", tag.Name()))
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
return
|
||||
default:
|
||||
log.Info("BAD URL = " + route)
|
||||
}
|
||||
}
|
||||
|
||||
// starts and sits waiting for HTTP requests
|
||||
func startHTTP() {
|
||||
http.HandleFunc("/", okHandler)
|
||||
|
||||
p := fmt.Sprintf(":%d", argv.Port)
|
||||
log.Println("Running on port", p)
|
||||
|
||||
err := http.ListenAndServe(p, nil)
|
||||
if err != nil {
|
||||
log.Println("Error starting server:", err)
|
||||
}
|
||||
}
|
||||
|
||||
func testNext() {
|
||||
// re-scans the go.sum file. DOES NOT MODIFY ANYTHING
|
||||
check := me.forge.Repos.FindByGoPath(me.current.GoPath())
|
||||
if check == nil {
|
||||
|
@ -167,8 +235,9 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
} else {
|
||||
log.Info("finalGoDepsCheck(check) failed. boo.")
|
||||
}
|
||||
return
|
||||
case "/showNext":
|
||||
}
|
||||
|
||||
func showNext() {
|
||||
log.Info("gui repo: " + me.release.repo.String())
|
||||
log.Info("gui name: " + me.release.version.String())
|
||||
log.Info("gui notes: " + me.release.notes.String())
|
||||
|
@ -226,56 +295,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
log.Info("")
|
||||
log.Info(repolist.ReleaseReportHeader())
|
||||
log.Info(me.current.StandardReleaseHeader())
|
||||
case "/list":
|
||||
PrintReport(readonly, onlydirty, perfect)
|
||||
case "/releaseList":
|
||||
PrintReleaseReport(readonly, perfect)
|
||||
case "/quit":
|
||||
log.Info("Got URL /quit")
|
||||
os.Exit(0)
|
||||
case "/goweblist":
|
||||
loop := me.repos.View.ReposAll()
|
||||
for loop.Scan() {
|
||||
repo := loop.Repo()
|
||||
|
||||
lastTag := repo.LastTag()
|
||||
tag := repo.Status.NewestTag()
|
||||
gitAge, err := tag.GetDate()
|
||||
if err != nil {
|
||||
log.Info(fmt.Sprintf("tag date error", repo.Name()))
|
||||
}
|
||||
// if lastTag == "" {
|
||||
// lastTag = tag.Name()
|
||||
// }
|
||||
if repo.ReadOnly() {
|
||||
if readonly == "true" {
|
||||
continue
|
||||
}
|
||||
}
|
||||
// dur := time.Since(gitAge)
|
||||
// log.Info(fmt.Sprintf("%-60s %s %s %s", repo.Name(), lastTag, shell.FormatDuration(dur), lastTag, tag.Name()))
|
||||
log.Info(fmt.Sprintf("%s %d %s", repo.Name(), gitAge.Unix(), lastTag))
|
||||
/*
|
||||
for _, tag := range repo.Tags.ListAll() {
|
||||
log.Info(fmt.Sprintf("%-60s %s", "", tag.Name()))
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
default:
|
||||
log.Info("BAD URL = " + route)
|
||||
}
|
||||
}
|
||||
|
||||
// starts and sits waiting for HTTP requests
|
||||
func startHTTP() {
|
||||
http.HandleFunc("/", okHandler)
|
||||
|
||||
p := fmt.Sprintf(":%d", argv.Port)
|
||||
log.Println("Running on port", p)
|
||||
|
||||
err := http.ListenAndServe(p, nil)
|
||||
if err != nil {
|
||||
log.Println("Error starting server:", err)
|
||||
}
|
||||
testNext()
|
||||
}
|
||||
|
|
|
@ -11,6 +11,15 @@ func makePrepareRelease() {
|
|||
me.release.box.Disable()
|
||||
defer me.Enable()
|
||||
|
||||
if setAllBranchesToMaster() {
|
||||
// if it succeeds, disable this button
|
||||
me.setBranchesToMasterB.Disable()
|
||||
me.release.box.Enable()
|
||||
PrintReleaseReport("", "")
|
||||
} else {
|
||||
log.Info("setAllBranchesToMaster() failed")
|
||||
}
|
||||
|
||||
// first reset all the target versions back to the current version
|
||||
// incase there was a partial release process running that
|
||||
// did not finish
|
||||
|
@ -65,7 +74,7 @@ func makePrepareRelease() {
|
|||
log.Info("arg final check true", check.GetGoPath())
|
||||
} else {
|
||||
log.Info("arg final check false", check.GetGoPath())
|
||||
os.Exit(-1)
|
||||
// os.Exit(-1)
|
||||
}
|
||||
// see if there is a new version
|
||||
master := repo.Status.GetMasterVersion()
|
||||
|
@ -117,12 +126,4 @@ func makePrepareRelease() {
|
|||
}
|
||||
}
|
||||
findNext()
|
||||
if setAllBranchesToMaster() {
|
||||
// if it succeeds, disable this button
|
||||
me.setBranchesToMasterB.Disable()
|
||||
me.release.box.Enable()
|
||||
PrintReleaseReport("", "")
|
||||
} else {
|
||||
log.Info("setAllBranchesToMaster() failed")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue