diff options
author | Russ Cox <rsc@golang.org> | 2012-02-09 23:46:48 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2012-02-09 23:46:48 -0500 |
commit | 70463c9d892378945bfbb448c1f3b9e326855978 (patch) | |
tree | 9a3f614b56768316fc576b6aa318b791ccbd815e /misc | |
parent | 70eec9fc61712e00a6131191e8f46973a9891043 (diff) | |
download | go-70463c9d892378945bfbb448c1f3b9e326855978.tar.gz |
dashboard: add gobuilder -fail mode
This is for filling a column with "fail", like I just did for
Windows, when the builder would get stuck running that
build. (We have safeguards against the tests getting stuck
but this was the bootstrap build getting stuck.)
I usually use -cmd=/bin/false, but this avoids the Mercurial
checkouts, which means it runs instantly instead of requiring
~1 minute per "fail".
R=golang-dev, adg
CC=golang-dev
http://codereview.appspot.com/5649049
Diffstat (limited to 'misc')
-rw-r--r-- | misc/dashboard/builder/main.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/misc/dashboard/builder/main.go b/misc/dashboard/builder/main.go index e77107ec8..bce930d40 100644 --- a/misc/dashboard/builder/main.go +++ b/misc/dashboard/builder/main.go @@ -54,6 +54,7 @@ var ( buildRelease = flag.Bool("release", false, "Build and upload binary release archives") buildRevision = flag.String("rev", "", "Build specified revision and exit") buildCmd = flag.String("cmd", filepath.Join(".", allCmd), "Build command (specify relative to go/src/)") + failAll = flag.Bool("fail", false, "fail all builds") external = flag.Bool("external", false, "Build external packages") parallel = flag.Bool("parallel", false, "Build multiple targets in parallel") verbose = flag.Bool("v", false, "verbose") @@ -87,6 +88,11 @@ func main() { } builders[i] = b } + + if *failAll { + failMode(builders) + return + } // set up work environment if err := os.RemoveAll(*buildroot); err != nil { @@ -161,6 +167,21 @@ func main() { } } +// go continuous fail mode +// check for new commits and FAIL them +func failMode(builders []*Builder) { + for { + built := false + for _, b := range builders { + built = b.failBuild() || built + } + // stop if there was nothing to fail + if !built { + break + } + } +} + func NewBuilder(builder string) (*Builder, error) { b := &Builder{name: builder} @@ -350,6 +371,27 @@ func (b *Builder) buildHash(hash string) error { return nil } +// failBuild checks for a new commit for this builder +// and fails it if one is found. +// It returns true if a build was "attempted". +func (b *Builder) failBuild() bool { + hash, err := b.todo("build-go-commit", "", "") + if err != nil { + log.Println(err) + return false + } + if hash == "" { + return false + } + + log.Printf("fail %s %s\n", b.name, hash) + + if err := b.recordResult(false, "", hash, "", "auto-fail mode run by " + os.Getenv("USER"), 0); err != nil { + log.Print(err) + } + return true +} + func (b *Builder) buildSubrepos(goRoot, goHash string) { for _, pkg := range dashboardPackages("subrepo") { // get the latest todo for this package |