man this doesn't work right
This commit is contained in:
parent
1c8815685b
commit
e9ecf2ed7e
7
argv.go
7
argv.go
|
@ -6,17 +6,18 @@ package main
|
||||||
this enables command line options from other packages like 'gui' and 'log'
|
this enables command line options from other packages like 'gui' and 'log'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type argv struct {
|
type args struct {
|
||||||
// Repo string `arg:"positional" help:"go import path"`
|
// Repo string `arg:"positional" help:"go import path"`
|
||||||
// Increment bool `arg:"--increment" help:"auto increment"`
|
// Increment bool `arg:"--increment" help:"auto increment"`
|
||||||
// Release bool `arg:"--release" help:"do a release an exit"`
|
// Release bool `arg:"--release" help:"do a release an exit"`
|
||||||
DryRun bool `arg:"--dry-run,env:DRYRUN" help:"don't actually do the release"`
|
DryRun bool `arg:"--dry-run,env:DRYRUN" help:"don't actually do the release"`
|
||||||
|
Fix bool `arg:"--fix" help:"run fixGoMod() on startup"`
|
||||||
Reason string `arg:"--reason" help:"tag message"`
|
Reason string `arg:"--reason" help:"tag message"`
|
||||||
DumpVersions bool `arg:"--dump-versions" help:"dump the versions file for go.wit.com"`
|
DumpVersions bool `arg:"--dump-versions" help:"dump the versions file for go.wit.com"`
|
||||||
Port int `arg:"--port" default:"9419" help:"do fun stuff with curl"`
|
Port int `arg:"--port" default:"9419" help:"do fun stuff with curl"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a argv) Description() string {
|
func (a args) Description() string {
|
||||||
return `
|
return `
|
||||||
Example usage:
|
Example usage:
|
||||||
guireleaser go.wit.com/apps/go-clone --increment --release --dry-run --reason "blerg"
|
guireleaser go.wit.com/apps/go-clone --increment --release --dry-run --reason "blerg"
|
||||||
|
@ -25,6 +26,6 @@ This will pull down the go sources and
|
||||||
the repositories in the go.sum file using git clone`
|
the repositories in the go.sum file using git clone`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (argv) Version() string {
|
func (args) Version() string {
|
||||||
return "guireleaser " + VERSION
|
return "guireleaser " + VERSION
|
||||||
}
|
}
|
||||||
|
|
11
doRelease.go
11
doRelease.go
|
@ -52,7 +52,9 @@ func doRelease() bool {
|
||||||
log.Info("boo, you didn't git clone", me.current.GoPath())
|
log.Info("boo, you didn't git clone", me.current.GoPath())
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if !me.forge.FinalGoDepsCheck(check) {
|
if !me.forge.FinalGoDepsCheckOk(check) {
|
||||||
|
log.Info("the go.mod file is wrong. fix it here?", check.GetGoPath())
|
||||||
|
os.Exit(-1)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +136,8 @@ func doRelease() bool {
|
||||||
}
|
}
|
||||||
log.Info("EVERYTHING OK. RERELEASED", me.current.Name())
|
log.Info("EVERYTHING OK. RERELEASED", me.current.Name())
|
||||||
|
|
||||||
// recreate go.mod / go.sum
|
// it's necessary to recreate the the files here
|
||||||
|
// safe to do this here. everything has been published
|
||||||
fixGodeps(me.current)
|
fixGodeps(me.current)
|
||||||
|
|
||||||
// update the values in the GUI
|
// update the values in the GUI
|
||||||
|
@ -152,6 +155,7 @@ func doRelease() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to figure out if there is another package to update
|
// try to figure out if there is another package to update
|
||||||
|
// returns true if it finds something
|
||||||
func doReleaseFindNext() bool {
|
func doReleaseFindNext() bool {
|
||||||
// scan for new repo
|
// scan for new repo
|
||||||
if findNext() {
|
if findNext() {
|
||||||
|
@ -165,7 +169,8 @@ func doReleaseFindNext() bool {
|
||||||
log.Info("boo, you didn't git clone", me.current.GoPath())
|
log.Info("boo, you didn't git clone", me.current.GoPath())
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if me.forge.FinalGoDepsCheck(check) {
|
if me.forge.FinalGoDepsCheckOk(check) {
|
||||||
|
// the go.sum file is ok to release
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -46,7 +46,7 @@ func findNext() bool {
|
||||||
log.Info("boo, you didn't git clone", repo.GoPath())
|
log.Info("boo, you didn't git clone", repo.GoPath())
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if me.forge.FinalGoDepsCheck(check) {
|
if me.forge.FinalGoDepsCheckOk(check) {
|
||||||
setCurrentRepo(repo, "should be good to release", "pretty sure")
|
setCurrentRepo(repo, "should be good to release", "pretty sure")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
5
http.go
5
http.go
|
@ -162,7 +162,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Info("boo, you didn't git clone", me.current.GoPath())
|
log.Info("boo, you didn't git clone", me.current.GoPath())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if me.forge.FinalGoDepsCheck(check) {
|
if me.forge.FinalGoDepsCheckOk(check) {
|
||||||
log.Info("finalGoDepsCheck(check) worked!")
|
log.Info("finalGoDepsCheck(check) worked!")
|
||||||
} else {
|
} else {
|
||||||
log.Info("finalGoDepsCheck(check) failed. boo.")
|
log.Info("finalGoDepsCheck(check) failed. boo.")
|
||||||
|
@ -220,7 +220,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Info("Whitelist == false")
|
log.Info("Whitelist == false")
|
||||||
}
|
}
|
||||||
log.Info("")
|
log.Info("")
|
||||||
fixGodeps(me.current)
|
|
||||||
|
|
||||||
log.Info(repolist.ReportHeader())
|
log.Info(repolist.ReportHeader())
|
||||||
log.Info(me.current.StandardHeader())
|
log.Info(me.current.StandardHeader())
|
||||||
|
@ -272,7 +271,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
func startHTTP() {
|
func startHTTP() {
|
||||||
http.HandleFunc("/", okHandler)
|
http.HandleFunc("/", okHandler)
|
||||||
|
|
||||||
p := fmt.Sprintf(":%d", myargs.Port)
|
p := fmt.Sprintf(":%d", argv.Port)
|
||||||
log.Println("Running on port", p)
|
log.Println("Running on port", p)
|
||||||
|
|
||||||
err := http.ListenAndServe(p, nil)
|
err := http.ListenAndServe(p, nil)
|
||||||
|
|
6
main.go
6
main.go
|
@ -18,7 +18,7 @@ var VERSION string
|
||||||
//go:embed resources/*
|
//go:embed resources/*
|
||||||
var resources embed.FS
|
var resources embed.FS
|
||||||
|
|
||||||
var myargs argv
|
var argv args
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
me = new(autoType)
|
me = new(autoType)
|
||||||
|
@ -29,7 +29,7 @@ func main() {
|
||||||
os.Setenv("REPO_WORK_PATH", me.forge.GetGoSrc())
|
os.Setenv("REPO_WORK_PATH", me.forge.GetGoSrc())
|
||||||
|
|
||||||
// parse the command line
|
// parse the command line
|
||||||
arg.MustParse(&myargs)
|
arg.MustParse(&argv)
|
||||||
|
|
||||||
// save the ENV var here
|
// save the ENV var here
|
||||||
me.releaseReasonS = os.Getenv("GUIRELEASE_REASON")
|
me.releaseReasonS = os.Getenv("GUIRELEASE_REASON")
|
||||||
|
@ -83,7 +83,7 @@ func main() {
|
||||||
// which should be all the git repositories in ~/go/src & the .config file
|
// which should be all the git repositories in ~/go/src & the .config file
|
||||||
me.repos = makeRepoView()
|
me.repos = makeRepoView()
|
||||||
|
|
||||||
if myargs.DumpVersions {
|
if argv.DumpVersions {
|
||||||
gowit.DumpVersions(me.repos.View)
|
gowit.DumpVersions(me.repos.View)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,23 +10,80 @@ func makePrepareRelease() {
|
||||||
me.Disable()
|
me.Disable()
|
||||||
me.release.box.Disable()
|
me.release.box.Disable()
|
||||||
defer me.Enable()
|
defer me.Enable()
|
||||||
|
|
||||||
|
// first reset all the target versions back to the current version
|
||||||
|
// incase there was a partial release process running that
|
||||||
|
// did not finish
|
||||||
loop := me.repos.View.ReposSortByName()
|
loop := me.repos.View.ReposSortByName()
|
||||||
for loop.Scan() {
|
for loop.Scan() {
|
||||||
repo := loop.Repo()
|
repo := loop.Repo()
|
||||||
// check if the package dependancies changed, if so, re-publish
|
|
||||||
|
// find the gitpb.Repo
|
||||||
check := me.forge.Repos.FindByGoPath(repo.GoPath())
|
check := me.forge.Repos.FindByGoPath(repo.GoPath())
|
||||||
if check == nil {
|
if check == nil {
|
||||||
log.Info("boo, you didn't git clone", repo.GoPath())
|
log.Info("boo, you didn't git clone", repo.GoPath())
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
if me.forge.FinalGoDepsCheck(check) {
|
|
||||||
log.Printf("dependancy checks indicate a new release is needed for %s\n", check.GetGoPath())
|
// set the target version to the current master version
|
||||||
repo.Status.IncrementRevisionVersion("godeps changed")
|
curver := repo.Status.GetMasterVersion()
|
||||||
target := repo.Status.GetTargetVersion()
|
check.SetTargetVersion(curver)
|
||||||
check.SetTargetVersion(target)
|
}
|
||||||
continue
|
|
||||||
} else {
|
// on startup, run fixGoDeps() on every go.sum that didn't match
|
||||||
log.Printf("dependancies have not changed for %s\n", check.GetGoPath())
|
if argv.Fix {
|
||||||
|
loop = me.repos.View.ReposSortByName()
|
||||||
|
for loop.Scan() {
|
||||||
|
repo := loop.Repo()
|
||||||
|
// find the gitpb.Repo
|
||||||
|
check := me.forge.Repos.FindByGoPath(repo.GoPath())
|
||||||
|
if check == nil {
|
||||||
|
log.Info("boo, you didn't git clone", repo.GoPath())
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
if !me.forge.FinalGoDepsCheckOk(check) {
|
||||||
|
fixGodeps(repo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// now figure out what to release and increment the version
|
||||||
|
loop = me.repos.View.ReposSortByName()
|
||||||
|
for loop.Scan() {
|
||||||
|
repo := loop.Repo()
|
||||||
|
// find the gitpb.Repo
|
||||||
|
check := me.forge.Repos.FindByGoPath(repo.GoPath())
|
||||||
|
if check == nil {
|
||||||
|
log.Info("boo, you didn't git clone", repo.GoPath())
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// if check.GetGoPath() == "go.wit.com/dev/alexflint/arg" {
|
||||||
|
if check.GetGoPath() == "go.wit.com/gui" {
|
||||||
|
log.Info("arg", check.GetGoPath(), check.GetMasterVersion(), check.GoPrimitive)
|
||||||
|
if me.forge.FinalGoDepsCheckOk(check) {
|
||||||
|
log.Info("arg final check true", check.GetGoPath())
|
||||||
|
} else {
|
||||||
|
log.Info("arg final check false", check.GetGoPath())
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
// see if there is a new version
|
||||||
|
master := repo.Status.GetMasterVersion()
|
||||||
|
lastTag := repo.Status.LastTag()
|
||||||
|
log.Info("arg ", master, lastTag)
|
||||||
|
// os.Exit(-1)
|
||||||
|
}
|
||||||
|
// check if the package dependancies changed, if so, re-publish
|
||||||
|
if !check.GoPrimitive {
|
||||||
|
if me.forge.FinalGoDepsCheckOk(check) {
|
||||||
|
log.Printf("go.sum is perfect! %s\n", check.GetGoPath())
|
||||||
|
} else {
|
||||||
|
log.Printf("dependancy checks indicate a new release is needed for %s\n", check.GetGoPath())
|
||||||
|
repo.Status.IncrementRevisionVersion("godeps changed")
|
||||||
|
target := repo.Status.GetTargetVersion()
|
||||||
|
check.SetTargetVersion(target)
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if there is a new version
|
// see if there is a new version
|
||||||
|
@ -39,6 +96,25 @@ func makePrepareRelease() {
|
||||||
target := repo.Status.GetTargetVersion()
|
target := repo.Status.GetTargetVersion()
|
||||||
check.SetTargetVersion(target)
|
check.SetTargetVersion(target)
|
||||||
}
|
}
|
||||||
|
// if check.GetGoPath() == "go.wit.com/dev/alexflint/arg" {
|
||||||
|
// if check.GetGoPath() == "go.wit.com/gui" {
|
||||||
|
if check.GetGoPath() == "go.wit.com/dev/davecgh/spew" {
|
||||||
|
log.Info(repo.StandardReleaseHeader())
|
||||||
|
log.Info(me.forge.StandardReleaseHeader(check, repo.State()))
|
||||||
|
log.Info("arg", check.GetGoPath(), check.GetMasterVersion(), check.GoPrimitive)
|
||||||
|
if me.forge.FinalGoDepsCheckOk(check) {
|
||||||
|
log.Info("go.sum is perfect")
|
||||||
|
} else {
|
||||||
|
log.Info("go.sum check false")
|
||||||
|
}
|
||||||
|
// see if there is a new version
|
||||||
|
master := repo.Status.GetMasterVersion()
|
||||||
|
lastTag := repo.Status.LastTag()
|
||||||
|
log.Info("arg ", master, lastTag)
|
||||||
|
if master != lastTag {
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
findNext()
|
findNext()
|
||||||
if setAllBranchesToMaster() {
|
if setAllBranchesToMaster() {
|
||||||
|
|
|
@ -133,12 +133,6 @@ func createReleaseBox(box *gui.Node) {
|
||||||
findNext()
|
findNext()
|
||||||
})
|
})
|
||||||
|
|
||||||
me.release.checkGoSumB = grid.NewButton("fixGoDeps()", func() {
|
|
||||||
buttonDisable()
|
|
||||||
fixGodeps(me.current)
|
|
||||||
buttonEnable()
|
|
||||||
})
|
|
||||||
|
|
||||||
grid.NextRow()
|
grid.NextRow()
|
||||||
|
|
||||||
group = me.release.box.NewGroup("Process against all repos")
|
group = me.release.box.NewGroup("Process against all repos")
|
||||||
|
|
Loading…
Reference in New Issue