dashboard: make git dashboard the default
Also bump the watcher version, so the old watcher doesn't try to write to the new dashboard. Change-Id: I7f62ad937fe162dadfd1222f56a3c5e493be9a61 Reviewed-on: https://go-review.googlesource.com/1357 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
9df76cfcdb
commit
6f3c548bba
|
@ -11,11 +11,11 @@ api_version: go1
|
||||||
handlers:
|
handlers:
|
||||||
- url: /static
|
- url: /static
|
||||||
static_dir: static
|
static_dir: static
|
||||||
- url: /(|gccgo/|git/)log/.+
|
- url: /(|gccgo/|hg/)log/.+
|
||||||
script: _go_app
|
script: _go_app
|
||||||
- url: /(|gccgo/|git/)(|commit|packages|result|perf-result|tag|todo|perf|perfdetail|perfgraph|updatebenchmark)
|
- url: /(|gccgo/|hg/)(|commit|packages|result|perf-result|tag|todo|perf|perfdetail|perfgraph|updatebenchmark)
|
||||||
script: _go_app
|
script: _go_app
|
||||||
- url: /(|gccgo/|git/)(init|buildtest|key|perflearn|_ah/queue/go/delay)
|
- url: /(|gccgo/|hg/)(init|buildtest|key|perflearn|_ah/queue/go/delay)
|
||||||
script: _go_app
|
script: _go_app
|
||||||
login: admin
|
login: admin
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@ func handleFunc(path string, h http.HandlerFunc) {
|
||||||
|
|
||||||
// Dashboard describes a unique build dashboard.
|
// Dashboard describes a unique build dashboard.
|
||||||
type Dashboard struct {
|
type Dashboard struct {
|
||||||
Name string // This dashboard's name and namespace
|
Name string // This dashboard's name (eg, "Go")
|
||||||
|
Namespace string // This dashboard's namespace (eg, "" (default), "Git")
|
||||||
Prefix string // The path prefix (no trailing /)
|
Prefix string // The path prefix (no trailing /)
|
||||||
Packages []*Package // The project's packages to build
|
Packages []*Package // The project's packages to build
|
||||||
}
|
}
|
||||||
|
@ -31,8 +32,8 @@ func dashboardForRequest(r *http.Request) *Dashboard {
|
||||||
if strings.HasPrefix(r.URL.Path, gccgoDash.Prefix) {
|
if strings.HasPrefix(r.URL.Path, gccgoDash.Prefix) {
|
||||||
return gccgoDash
|
return gccgoDash
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(r.URL.Path, gitDash.Prefix) {
|
if strings.HasPrefix(r.URL.Path, hgDash.Prefix) {
|
||||||
return gitDash
|
return goDash
|
||||||
}
|
}
|
||||||
return goDash
|
return goDash
|
||||||
}
|
}
|
||||||
|
@ -40,11 +41,10 @@ func dashboardForRequest(r *http.Request) *Dashboard {
|
||||||
// Context returns a namespaced context for this dashboard, or panics if it
|
// Context returns a namespaced context for this dashboard, or panics if it
|
||||||
// fails to create a new context.
|
// fails to create a new context.
|
||||||
func (d *Dashboard) Context(c appengine.Context) appengine.Context {
|
func (d *Dashboard) Context(c appengine.Context) appengine.Context {
|
||||||
// No namespace needed for the original Go dashboard.
|
if d.Namespace == "" {
|
||||||
if d.Name == "Go" {
|
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
n, err := appengine.Namespace(c, d.Name)
|
n, err := appengine.Namespace(c, d.Namespace)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -52,17 +52,19 @@ func (d *Dashboard) Context(c appengine.Context) appengine.Context {
|
||||||
}
|
}
|
||||||
|
|
||||||
// the currently known dashboards.
|
// the currently known dashboards.
|
||||||
var dashboards = []*Dashboard{goDash, gitDash, gccgoDash}
|
var dashboards = []*Dashboard{goDash, hgDash, gccgoDash}
|
||||||
|
|
||||||
// goDash is the dashboard for the main go repository.
|
// hgDash is the dashboard for the old Mercural Go repository.
|
||||||
var goDash = &Dashboard{
|
var hgDash = &Dashboard{
|
||||||
Name: "Go",
|
Name: "Mercurial",
|
||||||
Prefix: "",
|
Namespace: "", // Used to be the default.
|
||||||
Packages: goPackages,
|
Prefix: "/hg",
|
||||||
|
Packages: hgPackages,
|
||||||
}
|
}
|
||||||
|
|
||||||
// goPackages is a list of all of the packages built by the main go repository.
|
// hgPackages is a list of all of the packages
|
||||||
var goPackages = []*Package{
|
// built by the old Mercurial Go repository.
|
||||||
|
var hgPackages = []*Package{
|
||||||
{
|
{
|
||||||
Kind: "go",
|
Kind: "go",
|
||||||
Name: "Go",
|
Name: "Go",
|
||||||
|
@ -114,16 +116,16 @@ var goPackages = []*Package{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// gitDash is the dashboard for the main go repository on git.
|
// goDash is the dashboard for the main go repository.
|
||||||
var gitDash = &Dashboard{
|
var goDash = &Dashboard{
|
||||||
Name: "Git",
|
Name: "Go",
|
||||||
Prefix: "/git",
|
Namespace: "Git",
|
||||||
Packages: gitPackages,
|
Prefix: "",
|
||||||
|
Packages: goPackages,
|
||||||
}
|
}
|
||||||
|
|
||||||
// gitPackages is a list of all of the packages built by the main go repository
|
// goPackages is a list of all of the packages built by the main go repository.
|
||||||
// on git.
|
var goPackages = []*Package{
|
||||||
var gitPackages = []*Package{
|
|
||||||
{
|
{
|
||||||
Kind: "go",
|
Kind: "go",
|
||||||
Name: "Go",
|
Name: "Go",
|
||||||
|
@ -183,6 +185,7 @@ var gitPackages = []*Package{
|
||||||
// gccgoDash is the dashboard for gccgo.
|
// gccgoDash is the dashboard for gccgo.
|
||||||
var gccgoDash = &Dashboard{
|
var gccgoDash = &Dashboard{
|
||||||
Name: "Gccgo",
|
Name: "Gccgo",
|
||||||
|
Namespace: "Gccgo",
|
||||||
Prefix: "/gccgo",
|
Prefix: "/gccgo",
|
||||||
Packages: []*Package{
|
Packages: []*Package{
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,7 +27,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const commitsPerPage = 30
|
const commitsPerPage = 30
|
||||||
const watcherVersion = 2
|
const watcherVersion = 3 // must match dashboard/watcher/watcher.go's watcherVersion
|
||||||
|
|
||||||
// commitHandler retrieves commit data or records a new commit.
|
// commitHandler retrieves commit data or records a new commit.
|
||||||
//
|
//
|
||||||
|
|
|
@ -435,15 +435,11 @@ func repoURL(dashboard, hash, packagePath string) (string, error) {
|
||||||
if dashboard == "Gccgo" {
|
if dashboard == "Gccgo" {
|
||||||
return "https://code.google.com/p/gofrontend/source/detail?r=" + hash, nil
|
return "https://code.google.com/p/gofrontend/source/detail?r=" + hash, nil
|
||||||
}
|
}
|
||||||
if dashboard == "Git" {
|
|
||||||
return "https://go.googlesource.com/go/+/" + hash, nil
|
|
||||||
}
|
|
||||||
return "https://golang.org/change/" + hash, nil
|
return "https://golang.org/change/" + hash, nil
|
||||||
}
|
}
|
||||||
if dashboard == "Git" {
|
|
||||||
repo := strings.TrimPrefix(packagePath, "golang.org/x/")
|
// TODO(adg): remove this old hg stuff, one day.
|
||||||
return "https://go.googlesource.com/" + repo + "/+/" + hash, nil
|
if dashboard == "Mercurial" {
|
||||||
}
|
|
||||||
m := repoRe.FindStringSubmatch(packagePath)
|
m := repoRe.FindStringSubmatch(packagePath)
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return "", errors.New("unrecognized package: " + packagePath)
|
return "", errors.New("unrecognized package: " + packagePath)
|
||||||
|
@ -453,6 +449,10 @@ func repoURL(dashboard, hash, packagePath string) (string, error) {
|
||||||
url += "&repo=" + m[2][1:]
|
url += "&repo=" + m[2][1:]
|
||||||
}
|
}
|
||||||
return url, nil
|
return url, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
repo := strings.TrimPrefix(packagePath, "golang.org/x/")
|
||||||
|
return "https://go.googlesource.com/" + repo + "/+/" + hash, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// tail returns the trailing n lines of s.
|
// tail returns the trailing n lines of s.
|
||||||
|
|
|
@ -26,11 +26,16 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const goBase = "https://go.googlesource.com/"
|
const (
|
||||||
|
goBase = "https://go.googlesource.com/"
|
||||||
|
watcherVersion = 3 // must match dashboard/app/build/handler.go's watcherVersion
|
||||||
|
origin = "origin/"
|
||||||
|
master = origin + "master" // name of the master branch
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
repoURL = flag.String("repo", goBase+"go", "Repository URL")
|
repoURL = flag.String("repo", goBase+"go", "Repository URL")
|
||||||
dashboard = flag.String("dash", "https://build.golang.org/git/", "Dashboard URL (must end in /)")
|
dashboard = flag.String("dash", "https://build.golang.org/", "Dashboard URL (must end in /)")
|
||||||
keyFile = flag.String("key", defaultKeyFile, "Build dashboard key file")
|
keyFile = flag.String("key", defaultKeyFile, "Build dashboard key file")
|
||||||
pollInterval = flag.Duration("poll", 10*time.Second, "Remote repo poll interval")
|
pollInterval = flag.Duration("poll", 10*time.Second, "Remote repo poll interval")
|
||||||
network = flag.Bool("network", true, "Enable network calls (disable for testing)")
|
network = flag.Bool("network", true, "Enable network calls (disable for testing)")
|
||||||
|
@ -283,7 +288,7 @@ func (r *Repo) postCommit(c *Commit) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
u := *dashboard + "commit?version=2&key=" + dashboardKey
|
u := fmt.Sprintf("%vcommit?version=%v&key=%v", *dashboard, watcherVersion, dashboardKey)
|
||||||
resp, err := http.Post(u, "text/json", bytes.NewReader(b))
|
resp, err := http.Post(u, "text/json", bytes.NewReader(b))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -306,11 +311,6 @@ func (r *Repo) postCommit(c *Commit) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
origin = "origin/"
|
|
||||||
master = origin + "master" // name of the master branch
|
|
||||||
)
|
|
||||||
|
|
||||||
// update looks for new commits and branches,
|
// update looks for new commits and branches,
|
||||||
// and updates the commits and branches maps.
|
// and updates the commits and branches maps.
|
||||||
func (r *Repo) update(noisy bool) error {
|
func (r *Repo) update(noisy bool) error {
|
||||||
|
|
Loading…
Reference in New Issue