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
|
||||
|
||||
import "log"
|
||||
// import "fmt"
|
||||
import "os"
|
||||
import "os/user"
|
||||
import "time"
|
||||
import "runtime"
|
||||
// import "io/ioutil"
|
||||
// import "strings"
|
||||
// upload binary to mirrors.wit.com/cloud/control-panel
|
||||
|
||||
// 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 "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 builddir string
|
||||
var homedir string
|
||||
|
||||
func main() {
|
||||
// set build -ldflags for windows and macos
|
||||
// "
|
||||
// -X main.GITCOMMIT=${GITCOMMIT}
|
||||
// -X main.GOVERSION='${GOVERSION}'
|
||||
// -X main.BUILDTIME='${BUILDTIME}'
|
||||
// -X main.VERSION=${VERSION}
|
||||
// "
|
||||
BuildMap = make(map[string]*bool)
|
||||
|
||||
// upload binary to mirrors.wit.com/cloud/control-panel
|
||||
// shell.Quiet(true)
|
||||
shell.Quiet(false)
|
||||
|
||||
// shell.Run("git tag --list")
|
||||
// os.Exit(-1)
|
||||
|
||||
for {
|
||||
build()
|
||||
os.Exit(0)
|
||||
shell.Run("git pull --tags")
|
||||
shell.Run("go get -v -u -t")
|
||||
|
||||
findtags()
|
||||
time.Sleep(time.Second * 5)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func build() {
|
||||
func findtags() {
|
||||
tags := shell.Run("git tag --list")
|
||||
log.Println(tags)
|
||||
os.Exit(0)
|
||||
|
||||
// shell.SetDelayInMsec(50)
|
||||
shell.Run("go get -v .")
|
||||
|
||||
// -ldflags -H=windowsgui
|
||||
shell.Run("rm " + filename)
|
||||
if runtime.GOOS == "windows" {
|
||||
shell.Run("go build -ldflags -H=windowsgui")
|
||||
} else {
|
||||
shell.Run("go build")
|
||||
// log.Println(tags)
|
||||
for _, tag := range strings.Split(tags, "\n") {
|
||||
tag = strings.Replace(tag, "v", "", -1) // remove all 'v' chars
|
||||
log.Println("TAG =", tag)
|
||||
if (BuildMap[tag] == nil) {
|
||||
log.Println("\tCHECK IF BUILD WAS ATTEMPTED =", tag)
|
||||
BuildMap[tag] = build(tag)
|
||||
}
|
||||
}
|
||||
output := shell.Run("ls -l")
|
||||
shell.Run("cat VERSION")
|
||||
|
||||
log.Println("output =", output)
|
||||
// os.Exit(0)
|
||||
}
|
||||
|
||||
func ping() {
|
||||
shell.SetDelayInMsec(2000)
|
||||
shell.Run("ping -c 6 localhost")
|
||||
func build(tag string) *bool {
|
||||
url := "https://mirrors.wit.com/cloud/control-panel/linux/clound-control-panel-v" + tag + ".md5sum"
|
||||
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 setupUser() {
|
||||
// look up the user information
|
||||
func setbuilddir() {
|
||||
user, err := user.Current()
|
||||
spew.Dump(user)
|
||||
if err != nil {
|
||||
os.Exit(-1)
|
||||
}
|
||||
spew.Dump(user)
|
||||
|
||||
// TODO: confirm this is correct for MacOS and Windows
|
||||
if runtime.GOOS == "linux" {
|
||||
log.Println("loadConfigFile() OS: Linux")
|
||||
filename = "cloud-control-panel"
|
||||
|
@ -86,9 +110,8 @@ func setupUser() {
|
|||
filename = "cloud-control-panel.exe"
|
||||
} else {
|
||||
log.Println("loadConfigFile() OS: " + runtime.GOOS)
|
||||
builddir = user.HomeDir + "/go/src/git.wit.com/wit/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