more fixes. attempt version 0.6.24
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
0f6b111ac5
commit
397a66146b
119
build/main.go
119
build/main.go
|
@ -2,80 +2,104 @@ package main
|
||||||
|
|
||||||
// This should build and upload the binary to mirrors
|
// This should build and upload the binary to mirrors
|
||||||
|
|
||||||
import "log"
|
// upload binary to mirrors.wit.com/cloud/control-panel
|
||||||
// import "fmt"
|
|
||||||
import "os"
|
|
||||||
import "os/user"
|
|
||||||
import "time"
|
|
||||||
import "runtime"
|
|
||||||
// import "io/ioutil"
|
|
||||||
// import "strings"
|
|
||||||
|
|
||||||
// github.com/bramvdbogaerde/go-scp
|
import "log"
|
||||||
|
import "time"
|
||||||
|
import "strings"
|
||||||
|
import "os/user"
|
||||||
|
import "os"
|
||||||
|
import "runtime"
|
||||||
|
|
||||||
import "github.com/davecgh/go-spew/spew"
|
import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
import "git.wit.com/wit/shell"
|
import "git.wit.com/wit/shell"
|
||||||
|
|
||||||
|
// import "fmt"
|
||||||
|
// import "os/user"
|
||||||
|
// import "io/ioutil"
|
||||||
|
// github.com/bramvdbogaerde/go-scp
|
||||||
|
|
||||||
|
var BuildMap map[string]*bool
|
||||||
|
|
||||||
var filename string
|
var filename string
|
||||||
var builddir string
|
var builddir string
|
||||||
var homedir string
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// set build -ldflags for windows and macos
|
BuildMap = make(map[string]*bool)
|
||||||
// "
|
|
||||||
// -X main.GITCOMMIT=${GITCOMMIT}
|
|
||||||
// -X main.GOVERSION='${GOVERSION}'
|
|
||||||
// -X main.BUILDTIME='${BUILDTIME}'
|
|
||||||
// -X main.VERSION=${VERSION}
|
|
||||||
// "
|
|
||||||
|
|
||||||
// upload binary to mirrors.wit.com/cloud/control-panel
|
// shell.Quiet(true)
|
||||||
|
shell.Quiet(false)
|
||||||
|
|
||||||
|
// shell.Run("git tag --list")
|
||||||
|
// os.Exit(-1)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
build()
|
shell.Run("git pull --tags")
|
||||||
os.Exit(0)
|
shell.Run("go get -v -u -t")
|
||||||
|
|
||||||
|
findtags()
|
||||||
time.Sleep(time.Second * 5)
|
time.Sleep(time.Second * 5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func findtags() {
|
||||||
func build() {
|
|
||||||
tags := shell.Run("git tag --list")
|
tags := shell.Run("git tag --list")
|
||||||
log.Println(tags)
|
// log.Println(tags)
|
||||||
os.Exit(0)
|
for _, tag := range strings.Split(tags, "\n") {
|
||||||
|
tag = strings.Replace(tag, "v", "", -1) // remove all 'v' chars
|
||||||
// shell.SetDelayInMsec(50)
|
log.Println("TAG =", tag)
|
||||||
shell.Run("go get -v .")
|
if (BuildMap[tag] == nil) {
|
||||||
|
log.Println("\tCHECK IF BUILD WAS ATTEMPTED =", tag)
|
||||||
// -ldflags -H=windowsgui
|
BuildMap[tag] = build(tag)
|
||||||
shell.Run("rm " + filename)
|
}
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
shell.Run("go build -ldflags -H=windowsgui")
|
|
||||||
} else {
|
|
||||||
shell.Run("go build")
|
|
||||||
}
|
}
|
||||||
output := shell.Run("ls -l")
|
|
||||||
shell.Run("cat VERSION")
|
|
||||||
|
|
||||||
log.Println("output =", output)
|
// os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ping() {
|
func build(tag string) *bool {
|
||||||
shell.SetDelayInMsec(2000)
|
url := "https://mirrors.wit.com/cloud/control-panel/linux/clound-control-panel-v" + tag + ".md5sum"
|
||||||
shell.Run("ping -c 6 localhost")
|
md5sum := shell.Chomp(shell.Wget(url))
|
||||||
|
if (md5sum != "") {
|
||||||
|
log.Println("\tBUILD ALREADY DONE TAG =", tag, "md5sum =", md5sum)
|
||||||
|
var b bool
|
||||||
|
b = true
|
||||||
|
// for {}
|
||||||
|
return &b
|
||||||
|
}
|
||||||
|
// for {}
|
||||||
|
|
||||||
|
shell.Quiet(false)
|
||||||
|
shell.Run("git checkout v" + tag)
|
||||||
|
|
||||||
|
gitref := shell.Run("git rev-list -1 HEAD")
|
||||||
|
tagref := shell.Run("cat .git/refs/tags/v" + tag)
|
||||||
|
|
||||||
|
if (gitref != tagref) {
|
||||||
|
log.Println("\tJESUS.", gitref, "ne", tagref)
|
||||||
|
os.Exit(-1)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
shell.Run("rm clound-control-panel")
|
||||||
|
shell.Run("go build")
|
||||||
|
|
||||||
|
os.Exit(-1)
|
||||||
|
|
||||||
|
// This version has not been built yet
|
||||||
|
log.Println("\tTRY TO BUILD TAG =", tag)
|
||||||
|
var b bool
|
||||||
|
b = false
|
||||||
|
return &b
|
||||||
}
|
}
|
||||||
|
|
||||||
// func setupUser() string, string, string {
|
func setbuilddir() {
|
||||||
func setupUser() {
|
|
||||||
// look up the user information
|
|
||||||
user, err := user.Current()
|
user, err := user.Current()
|
||||||
|
spew.Dump(user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
spew.Dump(user)
|
|
||||||
|
|
||||||
// TODO: confirm this is correct for MacOS and Windows
|
|
||||||
if runtime.GOOS == "linux" {
|
if runtime.GOOS == "linux" {
|
||||||
log.Println("loadConfigFile() OS: Linux")
|
log.Println("loadConfigFile() OS: Linux")
|
||||||
filename = "cloud-control-panel"
|
filename = "cloud-control-panel"
|
||||||
|
@ -86,9 +110,8 @@ func setupUser() {
|
||||||
filename = "cloud-control-panel.exe"
|
filename = "cloud-control-panel.exe"
|
||||||
} else {
|
} else {
|
||||||
log.Println("loadConfigFile() OS: " + runtime.GOOS)
|
log.Println("loadConfigFile() OS: " + runtime.GOOS)
|
||||||
builddir = user.HomeDir + "/go/src/git.wit.com/wit/cloud-control-panel"
|
|
||||||
filename = "cloud-control-panel"
|
filename = "cloud-control-panel"
|
||||||
|
builddir = user.HomeDir + "/go/src/git.wit.com/wit/cloud-control-panel"
|
||||||
}
|
}
|
||||||
|
|
||||||
homedir = user.HomeDir
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.6.23
|
0.6.24
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
74cdf39cbe0ff012b763649902464971bf12ca1a
|
|
@ -0,0 +1 @@
|
||||||
|
2370069a0c9691da7738dede8244534e25450ca9
|
|
@ -0,0 +1 @@
|
||||||
|
9b27b2915a4a452bc0c6d2ab8377ae2153e9ad7f
|
|
@ -0,0 +1 @@
|
||||||
|
44a34afe8874e36933c69540a0c96bf42074bab8
|
|
@ -0,0 +1 @@
|
||||||
|
1dfe3940735db6e53e736e20280485c5817d757e
|
|
@ -0,0 +1 @@
|
||||||
|
ca8fe192b01a95b1af6cc80b0f8d584130d08884
|
|
@ -0,0 +1 @@
|
||||||
|
eca1e44139cb5e3d0376b72aed7ebc3a747b4309
|
|
@ -0,0 +1 @@
|
||||||
|
35c06f515bb201f9a4a453a12ba5615882e98b13
|
|
@ -0,0 +1 @@
|
||||||
|
1c3040c4e99ade5c266c5f0ed229ffe229891996
|
|
@ -0,0 +1 @@
|
||||||
|
fca9b170f96623acbd12d5182a4aa59e2a909e24
|
|
@ -0,0 +1 @@
|
||||||
|
26322fa7d5382c9c03cfab9d49ee8c317fbaad6c
|
|
@ -0,0 +1 @@
|
||||||
|
55499287b03f8af1c5ed256c8ac415d142981e36
|
|
@ -0,0 +1 @@
|
||||||
|
065562a7de4d75e50c30c9d543a57818b43a03e9
|
|
@ -0,0 +1 @@
|
||||||
|
0f6b111ac538f623b1ec708ac4ff6164ef9016d4
|
Loading…
Reference in New Issue