Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: milo/appengine/buildbot/build.go

Issue 2823413002: Milo buildbot: Add in the rest of the blame/commits information. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: milo/appengine/buildbot/build.go
diff --git a/milo/appengine/buildbot/build.go b/milo/appengine/buildbot/build.go
index ff849722415e0eab2655cb4a6c30e804690aced4..8ef610dab7043b0da3a287edb81fc0c7bf1a3459 100644
--- a/milo/appengine/buildbot/build.go
+++ b/milo/appengine/buildbot/build.go
@@ -380,25 +380,24 @@ func properties(b *buildbotBuild) (result []*resp.PropertyGroup) {
return
}
+type bbFile struct {
nodir 2017/04/19 18:37:48 what is this? i don't see its usage
hinoka 2017/04/20 22:09:43 Oops, this wasn't supposed to be here.
+ Name string `json:"name"`
+ Url interface{} `json:"url"`
+}
+
// blame extracts the commit and blame information from a buildbot build and
// returns it as a list of Commits.
func blame(b *buildbotBuild) (result []*resp.Commit) {
for _, c := range b.Sourcestamp.Changes {
- files := make([]string, len(c.Files))
- for i, f := range c.Files {
- // Buildbot stores files both as a string, or as a dict with a single entry
- // named "name". It doesn't matter to us what the type is, but we need
- // to reflect on the type anyways.
- if fn, ok := f.(string); ok {
- files[i] = fn
- } else if fn, ok := f.(struct{ Name string }); ok {
- files[i] = fn.Name
- }
- }
+ files := c.GetFiles()
result = append(result, &resp.Commit{
AuthorEmail: c.Who,
Repo: c.Repository,
- Revision: c.Revision,
+ CommitTime: time.Unix(int64(c.When), 0),
+ Revision: &resp.Link{
+ URL: c.Revlink,
+ Label: c.Revision,
+ },
Description: c.Comments,
Title: strings.Split(c.Comments, "\n")[0],
File: files,
@@ -412,6 +411,8 @@ func blame(b *buildbotBuild) (result []*resp.Commit) {
func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp {
ss := &resp.SourceStamp{}
rietveld := ""
+ got_revision := ""
+ repository := ""
issue := int64(-1)
// TODO(hinoka): Gerrit URLs.
for _, prop := range b.Properties {
@@ -431,11 +432,15 @@ func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp {
case "got_revision":
if v, ok := prop.Value.(string); ok {
- ss.Revision = v
+ got_revision = v
} else {
logging.Warningf(c, "Field got_revision is not a string: %#v", prop.Value)
}
+ case "repository":
+ if v, ok := prop.Value.(string); ok {
+ repository = v
+ }
}
}
if issue != -1 {
@@ -449,6 +454,14 @@ func sourcestamp(c context.Context, b *buildbotBuild) *resp.SourceStamp {
logging.Warningf(c, "Found issue but not rietveld property.")
}
}
+ if got_revision != "" {
+ ss.Revision = &resp.Link{
+ Label: got_revision,
+ }
+ if repository != "" {
+ ss.Revision.URL = repository + "/+/" + got_revision
+ }
+ }
return ss
}

Powered by Google App Engine
This is Rietveld 408576698