diff --git a/dashboard/app/build/handler.go b/dashboard/app/build/handler.go index b11d584b..258d5c12 100644 --- a/dashboard/app/build/handler.go +++ b/dashboard/app/build/handler.go @@ -26,8 +26,11 @@ import ( "key" ) -const commitsPerPage = 30 -const watcherVersion = 3 // must match dashboard/watcher/watcher.go's watcherVersion +const ( + commitsPerPage = 30 + watcherVersion = 3 // must match dashboard/watcher/watcher.go + builderVersion = 1 // must match dashboard/builder/http.go +) // commitHandler retrieves commit data or records a new commit. // @@ -85,10 +88,9 @@ func commitHandler(r *http.Request) (interface{}, error) { return nil, errors.New("can only POST commits with master key") } - // For now, the commit watcher doesn't support gccgo, - // so only do this check for Go commits. - // TODO(adg,cmang): remove this check when gccgo is supported. - if dashboardForRequest(r) == goDash { + // For now, the commit watcher doesn't support gccgo. + // TODO(adg,cmang): remove this exception when gccgo is supported. + if dashboardForRequest(r) != gccgoDash { v, _ := strconv.Atoi(r.FormValue("version")) if v != watcherVersion { return nil, fmt.Errorf("rejecting POST from commit watcher; need version %v", watcherVersion) @@ -524,6 +526,15 @@ func resultHandler(r *http.Request) (interface{}, error) { return nil, errBadMethod(r.Method) } + // For now, the gccgo builders are using the old stuff. + // TODO(adg,cmang): remove this exception when gccgo is updated. + if dashboardForRequest(r) != gccgoDash { + v, _ := strconv.Atoi(r.FormValue("version")) + if v != builderVersion { + return nil, fmt.Errorf("rejecting POST from builder; need version %v", builderVersion) + } + } + c := contextForRequest(r) res := new(Result) defer r.Body.Close() diff --git a/dashboard/builder/http.go b/dashboard/builder/http.go index 3fbad3a8..8d0923c4 100644 --- a/dashboard/builder/http.go +++ b/dashboard/builder/http.go @@ -16,6 +16,8 @@ import ( "time" ) +const builderVersion = 1 // keep in sync with dashboard/app/build/handler.go + type obj map[string]interface{} // dash runs the given method and command on the dashboard. @@ -24,15 +26,19 @@ type obj map[string]interface{} // If resp is non-nil the server's response is decoded into the value pointed // to by resp (resp must be a pointer). func dash(meth, cmd string, args url.Values, req, resp interface{}) error { + argsCopy := url.Values{"version": {fmt.Sprint(builderVersion)}} + for k, v := range args { + if k == "version" { + panic(`dash: reserved args key: "version"`) + } + argsCopy[k] = v + } var r *http.Response var err error if *verbose { - log.Println("dash <-", meth, cmd, args, req) - } - cmd = *dashboard + "/" + cmd - if len(args) > 0 { - cmd += "?" + args.Encode() + log.Println("dash <-", meth, cmd, argsCopy, req) } + cmd = *dashboard + "/" + cmd + "?" + argsCopy.Encode() switch meth { case "GET": if req != nil { diff --git a/dashboard/builder/main.go b/dashboard/builder/main.go index 35359cb4..211d8af5 100644 --- a/dashboard/builder/main.go +++ b/dashboard/builder/main.go @@ -53,7 +53,7 @@ var ( buildRevision = flag.String("rev", "", "Build specified revision and exit") buildCmd = flag.String("cmd", filepath.Join(".", allCmd), "Build command (specify relative to go/src/)") buildTool = flag.String("tool", "go", "Tool to build.") - gcPath = flag.String("gcpath", "code.google.com/p/go", "Path to download gc from") + gcPath = flag.String("gcpath", "go.googlesource.com/go", "Path to download gc from") gccPath = flag.String("gccpath", "https://github.com/mirrors/gcc.git", "Path to download gcc from") gccOpts = flag.String("gccopts", "", "Command-line options to pass to `make` when building gccgo") benchPath = flag.String("benchpath", "golang.org/x/benchmarks/bench", "Path to download benchmarks from")