aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gerrand <adg@golang.org>2010-09-21 20:32:36 +1000
committerAndrew Gerrand <adg@golang.org>2010-09-21 20:32:36 +1000
commit6952347200ccdc02cbb045b56f26536e8f18f80d (patch)
tree57d432d3aedfd2e5b95b020b975e100c48db8dc7
parenta33ad247a6694b2d7e77dfed7bdec4f67f993c1e (diff)
downloadgo-6952347200ccdc02cbb045b56f26536e8f18f80d.tar.gz
go-6952347200ccdc02cbb045b56f26536e8f18f80d.zip
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
-rw-r--r--misc/dashboard/builder/main.go97
1 files changed, 61 insertions, 36 deletions
diff --git a/misc/dashboard/builder/main.go b/misc/dashboard/builder/main.go
index 388a262b0a..d13e05b733 100644
--- a/misc/dashboard/builder/main.go
+++ b/misc/dashboard/builder/main.go
@@ -39,7 +39,8 @@ type BenchRequest struct {
var (
dashboard = flag.String("dashboard", "godashboard.appspot.com", "Go Dashboard Host")
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 (
@@ -76,6 +77,20 @@ func main() {
if err := run(nil, buildroot, "hg", "clone", hgUrl, goroot); err != nil {
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
for {
err := run(nil, goroot, "hg", "pull", "-u")
@@ -93,18 +108,24 @@ func main() {
// only run benchmarks if we didn't build anything
// so that they don't hold up the builder queue
if !built {
- // if we have no benchmarks to do, pause
- if benchRequests.Len() == 0 {
+ if !runQueuedBenchmark() {
+ // if we have no benchmarks to do, pause
time.Sleep(waitInterval)
- } else {
- runBenchmark(benchRequests.Pop().(BenchRequest))
- // after running one benchmark,
- // continue to find and build new revisions.
}
+ // after running one benchmark,
+ // 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) {
// run benchmarks and send to dashboard
pkg := path.Join(r.path, "go", "src", "pkg")
@@ -222,11 +243,15 @@ func (b *Builder) buildCommit(c Commit) (err os.Error) {
}
}()
- // clone repo at revision num (new candidate)
- err = run(nil, workpath,
- "hg", "clone",
- "-r", strconv.Itoa(c.num),
- goroot, "go")
+ // clone repo
+ err = run(nil, workpath, "hg", "clone", goroot, "go")
+ if err != nil {
+ return
+ }
+
+ // update to specified revision
+ err = run(nil, path.Join(workpath, "go"),
+ "hg", "update", "-r", strconv.Itoa(c.num))
if err != nil {
return
}
@@ -240,8 +265,17 @@ func (b *Builder) buildCommit(c Commit) (err os.Error) {
}
srcDir := path.Join(workpath, "go", "src")
- // build the release candidate
- buildLog, status, err := runLog(env, srcDir, "bash", "all.bash")
+ // check for all-${GOARCH,GOOS}.bash and use it if found
+ 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 {
return errf("all.bash: %s", err)
}
@@ -278,31 +312,22 @@ func (b *Builder) buildCommit(c Commit) (err os.Error) {
return errf("clean.bash: %s", err)
}
// upload binary release
- err = b.codeUpload(release)
- }
-
- return
-}
-
-func (b *Builder) codeUpload(release string) (err os.Error) {
- defer func() {
+ fn := fmt.Sprintf("%s.%s-%s.tar.gz", release, b.goos, b.goarch)
+ err = run(nil, workpath, "tar", "czf", fn, "go")
if err != nil {
- err = errf("%s codeUpload release: %s: %s", b.name, release, err)
+ return errf("tar: %s", err)
}
- }()
- fn := fmt.Sprintf("%s.%s-%s.tar.gz", release, b.goos, b.goarch)
- err = run(nil, "", "tar", "czf", fn, "go")
- if err != nil {
- return
+ err = run(nil, workpath, "python",
+ path.Join(goroot, codePyScript),
+ "-s", release,
+ "-p", codeProject,
+ "-u", b.codeUsername,
+ "-w", b.codePassword,
+ "-l", fmt.Sprintf("%s,%s", b.goos, b.goarch),
+ fn)
}
- return run(nil, "", "python",
- path.Join(goroot, codePyScript),
- "-s", release,
- "-p", codeProject,
- "-u", b.codeUsername,
- "-w", b.codePassword,
- "-l", fmt.Sprintf("%s,%s", b.goos, b.goarch),
- fn)
+
+ return
}
func isDirectory(name string) bool {