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

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

Issue 2102903002: Milo: Extract the rietveld information from buildbot. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | appengine/cmd/milo/buildbot/expectations/CrWinGoma.30608.build.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/cmd/milo/buildbot/build.go
diff --git a/appengine/cmd/milo/buildbot/build.go b/appengine/cmd/milo/buildbot/build.go
index 772075574d632ba24656e48420e8d9507de46da7..2404c1f50bfd698530a71e9d7c0a7c88c0ea598e 100644
--- a/appengine/cmd/milo/buildbot/build.go
+++ b/appengine/cmd/milo/buildbot/build.go
@@ -341,6 +341,38 @@ func blame(b *buildbotBuild) (result []*resp.Commit) {
return
}
+// sourcestamp extracts the source stamp from various parts of a buildbot build,
+// including the properties.
+func sourcestamp(b *buildbotBuild) *resp.SourceStamp {
+ ss := &resp.SourceStamp{}
+ rietveld := ""
+ issue := int64(-1)
+ // TODO(hinoka): Gerrit URLs.
+ for _, prop := range b.Properties {
+ key := prop[0].(string)
+ value := prop[1]
+ switch key {
+ case "rietveld":
+ rietveld = value.(string)
+ case "issue":
+ issue = int64(value.(float64))
+ case "got_revision":
+ ss.Revision = value.(string)
+ }
+ }
nodir 2016/06/28 02:06:44 This code will panic if user input malformed, we s
Ryan Tseng 2016/06/28 21:49:31 Done.
+ if issue != -1 && rietveld == "" {
+ // Default rietveld server
+ rietveld = "https://codereview.chromium.org"
nodir 2016/06/28 02:06:44 Do we have to define defaults in our code? Do we h
Ryan Tseng 2016/06/28 21:49:31 Not sure, this is just incase. I'll remove this
+ }
+ if issue != -1 {
+ ss.Changelist = &resp.Link{
+ Label: fmt.Sprintf("Issue %d", issue),
+ URL: fmt.Sprintf("%s/%d", rietveld, issue),
nodir 2016/06/28 02:06:44 What if rietveld ends with / Trim it
Ryan Tseng 2016/06/28 21:49:31 Done.
+ }
+ }
+ return ss
+}
+
func getDebugBuild(c context.Context, builder, buildNum string) (*buildbotBuild, error) {
fname := fmt.Sprintf("%s.%s.json", builder, buildNum)
path := filepath.Join("testdata", "buildbot", fname)
@@ -366,6 +398,7 @@ func build(c context.Context, master, builder, buildNum string) (*resp.MiloBuild
}
return &resp.MiloBuild{
+ SourceStamp: sourcestamp(b),
Summary: summary(b),
Components: components(b),
PropertyGroup: properties(b),
« no previous file with comments | « no previous file | appengine/cmd/milo/buildbot/expectations/CrWinGoma.30608.build.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698