| Index: milo/appengine/buildbot/build.go
|
| diff --git a/milo/appengine/buildbot/build.go b/milo/appengine/buildbot/build.go
|
| index 1d88681de1e3d1e6f65cb10094e320d21c25313f..00be7487a54bbb0010dbe3b8ef0ac7e1df0c0de8 100644
|
| --- a/milo/appengine/buildbot/build.go
|
| +++ b/milo/appengine/buildbot/build.go
|
| @@ -13,6 +13,7 @@ import (
|
| "path/filepath"
|
| "regexp"
|
| "sort"
|
| + "strconv"
|
| "strings"
|
| "time"
|
|
|
| @@ -395,6 +396,7 @@ func blame(b *buildbotBuild) (result []*resp.Commit) {
|
| func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp {
|
| ss := &resp.SourceStamp{}
|
| rietveld := ""
|
| + gerrit := ""
|
| got_revision := ""
|
| repository := ""
|
| issue := int64(-1)
|
| @@ -408,10 +410,17 @@ func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp {
|
| logging.Warningf(c, "Field rietveld is not a string: %#v", prop.Value)
|
| }
|
| case "issue":
|
| + // Sometime this is a number (float), sometime it is a string.
|
| if v, ok := prop.Value.(float64); ok {
|
| issue = int64(v)
|
| + } else if v, ok := prop.Value.(string); ok {
|
| + if vi, err := strconv.Atoi(v); err == nil {
|
| + issue = int64(vi)
|
| + } else {
|
| + logging.Warningf(c, "Could not decode field issue: %q - %s", prop.Value, err)
|
| + }
|
| } else {
|
| - logging.Warningf(c, "Field issue is not a float: %#v", prop.Value)
|
| + logging.Warningf(c, "Field issue is not a string or float: %#v", prop.Value)
|
| }
|
|
|
| case "got_revision":
|
| @@ -421,6 +430,20 @@ func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp {
|
| logging.Warningf(c, "Field got_revision is not a string: %#v", prop.Value)
|
| }
|
|
|
| + case "patch_issue":
|
| + if v, ok := prop.Value.(float64); ok {
|
| + issue = int64(v)
|
| + } else {
|
| + logging.Warningf(c, "Field patch_issue is not a float: %#v", prop.Value)
|
| + }
|
| +
|
| + case "patch_gerrit_url":
|
| + if v, ok := prop.Value.(string); ok {
|
| + gerrit = v
|
| + } else {
|
| + logging.Warningf(c, "Field gerrit is not a string: %#v", prop.Value)
|
| + }
|
| +
|
| case "repository":
|
| if v, ok := prop.Value.(string); ok {
|
| repository = v
|
| @@ -428,16 +451,20 @@ func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp {
|
| }
|
| }
|
| if issue != -1 {
|
| - if rietveld != "" {
|
| + switch {
|
| + case rietveld != "":
|
| rietveld = strings.TrimRight(rietveld, "/")
|
| ss.Changelist = resp.NewLink(
|
| - fmt.Sprintf("Issue %d", issue),
|
| - fmt.Sprintf("%s/%d", rietveld, issue),
|
| - )
|
| - } else {
|
| - logging.Warningf(c, "Found issue but not rietveld property.")
|
| + fmt.Sprintf("Rietveld CL %d", issue),
|
| + fmt.Sprintf("%s/%d", rietveld, issue))
|
| + case gerrit != "":
|
| + gerrit = strings.TrimRight(gerrit, "/")
|
| + ss.Changelist = resp.NewLink(
|
| + fmt.Sprintf("Gerrit CL %d", issue),
|
| + fmt.Sprintf("%s/c/%d", gerrit, issue))
|
| }
|
| }
|
| +
|
| if got_revision != "" {
|
| ss.Revision = resp.NewLink(got_revision, "")
|
| if repository != "" {
|
|
|