]> Cypherpunks repositories - gostls13.git/commitdiff
dashboard: ask builders to re-build Go tip to freshen subrepos
authorAndrew Gerrand <adg@golang.org>
Mon, 30 Jan 2012 03:50:36 +0000 (14:50 +1100)
committerAndrew Gerrand <adg@golang.org>
Mon, 30 Jan 2012 03:50:36 +0000 (14:50 +1100)
This ensures we always have results for subrepo-tip at go-tip.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5569091

misc/dashboard/app/build/build.go
misc/dashboard/app/build/handler.go
misc/dashboard/app/build/test.go
misc/dashboard/app/build/ui.go

index 8dbefe9d38ed2a338aafb80b57e58538fc8a8e46..7b73a252150d0d4be2d1631fec37b86619c5083a 100644 (file)
@@ -262,6 +262,13 @@ func (t *Tag) Valid() os.Error {
        return nil
 }
 
+// Commit returns the Commit that corresponds with this Tag.
+func (t *Tag) Commit(c appengine.Context) (*Commit, os.Error) {
+       com := &Commit{Hash: t.Hash}
+       err := datastore.Get(c, com.Key(c), com)
+       return com, err
+}
+
 // GetTag fetches a Tag by name from the datastore.
 func GetTag(c appengine.Context, tag string) (*Tag, os.Error) {
        t := &Tag{Kind: tag}
index 9dcf128dc30f939317995072b114f9be6df2387c..4aa161e8d2269e8e91af5bbf9f8bc13a4c0db54b 100644 (file)
@@ -196,17 +196,44 @@ func buildTodo(c appengine.Context, builder, packagePath, goHash string) (interf
                Run(c)
        for {
                com := new(Commit)
-               if _, err := t.Next(com); err != nil {
-                       if err == datastore.Done {
-                               err = nil
-                       }
+               if _, err := t.Next(com); err == datastore.Done {
+                       break
+               } else if err != nil {
                        return nil, err
                }
                if com.Result(builder, goHash) == nil {
                        return com, nil
                }
        }
-       panic("unreachable")
+
+       // Nothing left to do if this is a package (not the Go tree).
+       if packagePath != "" {
+               return nil, nil
+       }
+
+       // If there are no Go tree commits left to build,
+       // see if there are any subrepo commits that need to be built at tip.
+       // If so, ask the builder to build a go tree at the tip commit.
+       // TODO(adg): do the same for "weekly" and "release" tags.
+       tag, err := GetTag(c, "tip")
+       if err != nil {
+               return nil, err
+       }
+       pkgs, err := Packages(c, "subrepo")
+       if err != nil {
+               return nil, err
+       }
+       for _, pkg := range pkgs {
+               com, err := pkg.LastCommit(c)
+               if err != nil {
+                       c.Warningf("%v: no Commit found: %v", pkg, err)
+                       continue
+               }
+               if com.Result(builder, tag.Hash) == nil {
+                       return tag.Commit(c)
+               }
+       }
+       return nil, nil
 }
 
 // packagesHandler returns a list of the non-Go Packages monitored
index f22eac1a498a5792f562cd8243fc5bb0dd7b1e25..6f17de02bce89659bf3d1e12f088ced50b5a7518 100644 (file)
@@ -109,7 +109,11 @@ var testRequests = []struct {
        {"/result", nil, &Result{PackagePath: testPkg, Builder: "linux-386", Hash: "1001", GoHash: "0001", OK: true}, nil},
        {"/todo", url.Values{"kind": {"build-package"}, "builder": {"linux-386"}, "packagePath": {testPkg}, "goHash": {"0001"}}, nil, nil},
        {"/todo", url.Values{"kind": {"build-package"}, "builder": {"linux-386"}, "packagePath": {testPkg}, "goHash": {"0002"}}, nil, &Todo{Kind: "build-package", Data: &Commit{Hash: "1003"}}},
+
+       // re-build Go revision for stale subrepos
+       {"/todo", url.Values{"kind": {"build-go-commit"}, "builder": {"linux-386"}}, nil, &Todo{Kind: "build-go-commit", Data: &Commit{Hash: "0005"}}},
        {"/result", nil, &Result{PackagePath: testPkg, Builder: "linux-386", Hash: "1001", GoHash: "0005", OK: false, Log: "boo"}, nil},
+       {"/todo", url.Values{"kind": {"build-go-commit"}, "builder": {"linux-386"}}, nil, nil},
 }
 
 func testHandler(w http.ResponseWriter, r *http.Request) {
@@ -215,8 +219,8 @@ func testHandler(w http.ResponseWriter, r *http.Request) {
                                errorf("Response.Data not *Commit: %T", g.Data)
                                return
                        }
-                       if e.Data.(*Commit).Hash != gd.Hash {
-                               errorf("hashes don't match: got %q, want %q", g, e)
+                       if eh := e.Data.(*Commit).Hash; eh != gd.Hash {
+                               errorf("hashes don't match: got %q, want %q", gd.Hash, eh)
                                return
                        }
                }
index 37a150063398011654e5822868c268e7f66f151b..bc5a703455bb15c03c48579af56b80f3dcf52b0e 100644 (file)
@@ -145,7 +145,7 @@ func TagState(c appengine.Context, name string) ([]*PackageState, os.Error) {
        for _, pkg := range pkgs {
                commit, err := pkg.LastCommit(c)
                if err != nil {
-                       c.Errorf("no Commit found: %v", pkg)
+                       c.Warningf("%v: no Commit found: %v", pkg, err)
                        continue
                }
                results := commit.Results(tag.Hash)