mirror of
https://github.com/golang/go
synced 2024-11-22 03:24:41 -07:00
misc/dashboard/builder: fixes and improvements
- fix release upload - add -rev= flag to build specific revision and exit - added support for all-$GOARCH.bash R=rsc CC=golang-dev https://golang.org/cl/2247044
This commit is contained in:
parent
a33ad247a6
commit
6952347200
@ -39,7 +39,8 @@ type BenchRequest struct {
|
|||||||
var (
|
var (
|
||||||
dashboard = flag.String("dashboard", "godashboard.appspot.com", "Go Dashboard Host")
|
dashboard = flag.String("dashboard", "godashboard.appspot.com", "Go Dashboard Host")
|
||||||
runBenchmarks = flag.Bool("bench", false, "Run benchmarks")
|
runBenchmarks = flag.Bool("bench", false, "Run benchmarks")
|
||||||
buildRelease = flag.Bool("release", false, "Build and deliver binary release archive")
|
buildRelease = flag.Bool("release", false, "Build and upload binary release archives")
|
||||||
|
buildRevision = flag.String("rev", "", "Build specified revision and exit")
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -76,6 +77,20 @@ func main() {
|
|||||||
if err := run(nil, buildroot, "hg", "clone", hgUrl, goroot); err != nil {
|
if err := run(nil, buildroot, "hg", "clone", hgUrl, goroot); err != nil {
|
||||||
log.Exit("Error cloning repository:", err)
|
log.Exit("Error cloning repository:", err)
|
||||||
}
|
}
|
||||||
|
// if specified, build revision and return
|
||||||
|
if *buildRevision != "" {
|
||||||
|
c, err := getCommit(*buildRevision)
|
||||||
|
if err != nil {
|
||||||
|
log.Exit("Error finding revision:", err)
|
||||||
|
}
|
||||||
|
for _, b := range builders {
|
||||||
|
if err := b.buildCommit(c); err != nil {
|
||||||
|
log.Stderr(err)
|
||||||
|
}
|
||||||
|
runQueuedBenchmark()
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
// check for new commits and build them
|
// check for new commits and build them
|
||||||
for {
|
for {
|
||||||
err := run(nil, goroot, "hg", "pull", "-u")
|
err := run(nil, goroot, "hg", "pull", "-u")
|
||||||
@ -93,16 +108,22 @@ func main() {
|
|||||||
// only run benchmarks if we didn't build anything
|
// only run benchmarks if we didn't build anything
|
||||||
// so that they don't hold up the builder queue
|
// so that they don't hold up the builder queue
|
||||||
if !built {
|
if !built {
|
||||||
|
if !runQueuedBenchmark() {
|
||||||
// if we have no benchmarks to do, pause
|
// if we have no benchmarks to do, pause
|
||||||
if benchRequests.Len() == 0 {
|
|
||||||
time.Sleep(waitInterval)
|
time.Sleep(waitInterval)
|
||||||
} else {
|
}
|
||||||
runBenchmark(benchRequests.Pop().(BenchRequest))
|
|
||||||
// after running one benchmark,
|
// after running one benchmark,
|
||||||
// continue to find and build new revisions.
|
// continue to find and build new revisions.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func runQueuedBenchmark() bool {
|
||||||
|
if benchRequests.Len() == 0 {
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
runBenchmark(benchRequests.Pop().(BenchRequest))
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func runBenchmark(r BenchRequest) {
|
func runBenchmark(r BenchRequest) {
|
||||||
@ -222,11 +243,15 @@ func (b *Builder) buildCommit(c Commit) (err os.Error) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// clone repo at revision num (new candidate)
|
// clone repo
|
||||||
err = run(nil, workpath,
|
err = run(nil, workpath, "hg", "clone", goroot, "go")
|
||||||
"hg", "clone",
|
if err != nil {
|
||||||
"-r", strconv.Itoa(c.num),
|
return
|
||||||
goroot, "go")
|
}
|
||||||
|
|
||||||
|
// update to specified revision
|
||||||
|
err = run(nil, path.Join(workpath, "go"),
|
||||||
|
"hg", "update", "-r", strconv.Itoa(c.num))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -240,8 +265,17 @@ func (b *Builder) buildCommit(c Commit) (err os.Error) {
|
|||||||
}
|
}
|
||||||
srcDir := path.Join(workpath, "go", "src")
|
srcDir := path.Join(workpath, "go", "src")
|
||||||
|
|
||||||
// build the release candidate
|
// check for all-${GOARCH,GOOS}.bash and use it if found
|
||||||
buildLog, status, err := runLog(env, srcDir, "bash", "all.bash")
|
allbash := "all.bash"
|
||||||
|
if a := "all-"+b.goarch+".bash"; isFile(path.Join(srcDir, a)) {
|
||||||
|
allbash = a
|
||||||
|
}
|
||||||
|
if a := "all-"+b.goos+".bash"; isFile(path.Join(srcDir, a)) {
|
||||||
|
allbash = a
|
||||||
|
}
|
||||||
|
|
||||||
|
// build
|
||||||
|
buildLog, status, err := runLog(env, srcDir, "bash", allbash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errf("all.bash: %s", err)
|
return errf("all.bash: %s", err)
|
||||||
}
|
}
|
||||||
@ -278,24 +312,12 @@ func (b *Builder) buildCommit(c Commit) (err os.Error) {
|
|||||||
return errf("clean.bash: %s", err)
|
return errf("clean.bash: %s", err)
|
||||||
}
|
}
|
||||||
// upload binary release
|
// upload binary release
|
||||||
err = b.codeUpload(release)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *Builder) codeUpload(release string) (err os.Error) {
|
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
err = errf("%s codeUpload release: %s: %s", b.name, release, err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
fn := fmt.Sprintf("%s.%s-%s.tar.gz", release, b.goos, b.goarch)
|
fn := fmt.Sprintf("%s.%s-%s.tar.gz", release, b.goos, b.goarch)
|
||||||
err = run(nil, "", "tar", "czf", fn, "go")
|
err = run(nil, workpath, "tar", "czf", fn, "go")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return errf("tar: %s", err)
|
||||||
}
|
}
|
||||||
return run(nil, "", "python",
|
err = run(nil, workpath, "python",
|
||||||
path.Join(goroot, codePyScript),
|
path.Join(goroot, codePyScript),
|
||||||
"-s", release,
|
"-s", release,
|
||||||
"-p", codeProject,
|
"-p", codeProject,
|
||||||
@ -303,6 +325,9 @@ func (b *Builder) codeUpload(release string) (err os.Error) {
|
|||||||
"-w", b.codePassword,
|
"-w", b.codePassword,
|
||||||
"-l", fmt.Sprintf("%s,%s", b.goos, b.goarch),
|
"-l", fmt.Sprintf("%s,%s", b.goos, b.goarch),
|
||||||
fn)
|
fn)
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func isDirectory(name string) bool {
|
func isDirectory(name string) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user