working autobuild on linux
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
2513e32e7d
commit
dc1c865164
|
@ -19,7 +19,7 @@ example-aminal/example-aminal
|
|||
example-multiple-windows/example-multiple-windows
|
||||
example-lookupAAAA/example-lookupAAAA
|
||||
|
||||
build/build
|
||||
autobuild/autobuild
|
||||
|
||||
test1/test1
|
||||
test2/test2
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
all:
|
||||
go install
|
|
@ -28,6 +28,8 @@ var builddir string
|
|||
func main() {
|
||||
BuildMap = make(map[string]*bool)
|
||||
|
||||
setbuilddir()
|
||||
|
||||
// shell.Quiet(true)
|
||||
shell.Quiet(false)
|
||||
|
||||
|
@ -35,8 +37,9 @@ func main() {
|
|||
// os.Exit(-1)
|
||||
|
||||
for {
|
||||
shell.Run("git checkout master")
|
||||
shell.Run("git pull --tags")
|
||||
shell.Run("go get -v -u -t")
|
||||
// shell.Run("go get -v -u -t")
|
||||
|
||||
findtags()
|
||||
time.Sleep(time.Second * 5)
|
||||
|
@ -48,10 +51,16 @@ func findtags() {
|
|||
// 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("TAG =", tag, "is nil")
|
||||
log.Println("\tCHECK IF BUILD WAS ATTEMPTED =", tag)
|
||||
BuildMap[tag] = build(tag)
|
||||
} else {
|
||||
if (*BuildMap[tag] == true) {
|
||||
log.Println("TAG =", tag, "is true")
|
||||
} else {
|
||||
log.Println("TAG =", tag, "is false")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,11 +68,12 @@ func findtags() {
|
|||
}
|
||||
|
||||
func build(tag string) *bool {
|
||||
url := "https://mirrors.wit.com/cloud/control-panel/linux/clound-control-panel-v" + tag + ".md5sum"
|
||||
var b bool
|
||||
url := "https://mirrors.wit.com/cloud/control-panel/linux/" + filename + "-v" + tag + ".md5sum"
|
||||
log.Println("\tTRYING URL", url)
|
||||
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
|
||||
|
@ -81,15 +91,22 @@ func build(tag string) *bool {
|
|||
os.Exit(-1)
|
||||
return nil
|
||||
}
|
||||
shell.Run("rm clound-control-panel")
|
||||
shell.Run("rm cloud-control-panel")
|
||||
shell.Run("go build")
|
||||
md5sum = shell.Run("md5sum cloud-control-panel")
|
||||
log.Println("\tmd5sum =", md5sum)
|
||||
|
||||
os.Exit(-1)
|
||||
if (md5sum == "") {
|
||||
log.Println("\tBUILD FAILED")
|
||||
b = false
|
||||
return &b
|
||||
}
|
||||
shell.Write("/tmp/autobuild.md5sum", md5sum)
|
||||
upload(tag)
|
||||
|
||||
// This version has not been built yet
|
||||
log.Println("\tTRY TO BUILD TAG =", tag)
|
||||
var b bool
|
||||
b = false
|
||||
// This version has been built yet
|
||||
log.Println("\tTHIS VERSION HAS BEEN UPLOADED =", tag)
|
||||
b = true
|
||||
return &b
|
||||
}
|
||||
|
||||
|
@ -115,3 +132,13 @@ func setbuilddir() {
|
|||
}
|
||||
}
|
||||
|
||||
// upload the files to mirrors
|
||||
func upload(tag string) {
|
||||
mirrors := "root@mirrors.wit.com:/data/mirrors/cloud/control-panel/linux/"
|
||||
|
||||
shell.Run("scp resources/VERSION " + mirrors)
|
||||
shell.Run("scp resources/BUILDDATE " + mirrors)
|
||||
shell.Run("scp cloud-control-panel " + mirrors)
|
||||
shell.Run("scp cloud-control-panel " + mirrors + "cloud-control-panel-v" + tag)
|
||||
shell.Run("scp /tmp/autobuild.md5sum " + mirrors + "cloud-control-panel-v" + tag + ".md5sum")
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
all:
|
||||
go build
|
||||
./build
|
Loading…
Reference in New Issue