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

Unified Diff: milo/api/resp/build.go

Issue 2979283002: Add manifest links and hack to index on revision. (Closed)
Patch Set: actually upload Created 3 years, 5 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 | « common/proto/milo/annotations.pb.go ('k') | milo/buildsource/buildbot/pubsub.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/api/resp/build.go
diff --git a/milo/api/resp/build.go b/milo/api/resp/build.go
index 582f4df6234a72f20f08476d90631db6e8664fcc..1cf550d120f6338d16d7dbb24ac4c38e93e931fa 100644
--- a/milo/api/resp/build.go
+++ b/milo/api/resp/build.go
@@ -18,9 +18,14 @@
package resp
import (
+ "encoding/hex"
"encoding/json"
"time"
+ "golang.org/x/net/context"
+
+ "github.com/luci/luci-go/common/logging"
+ "github.com/luci/luci-go/milo/common"
"github.com/luci/luci-go/milo/common/model"
)
@@ -278,7 +283,7 @@ func (comp *BuildComponent) toModelSummary() model.Summary {
}
// SummarizeTo summarizes the data into a given model.BuildSummary.
-func (rb *MiloBuild) SummarizeTo(bs *model.BuildSummary) {
+func (rb *MiloBuild) SummarizeTo(c context.Context, bs *model.BuildSummary) error {
bs.Summary = rb.Summary.toModelSummary()
if rb.Summary.Status == model.Running {
// Assume the last step is the current step.
@@ -288,13 +293,29 @@ func (rb *MiloBuild) SummarizeTo(bs *model.BuildSummary) {
}
}
if rb.SourceStamp != nil {
- // TODO(hinoka): This should be full manifests, but lets just use single
- // revisions for now.
+ // TODO(hinoka, iannucci): This should be full manifests, but lets just use
+ // single revisions for now. HACKS!
if rb.SourceStamp.Revision != nil {
- bs.Manifests = append(bs.Manifests, model.ManifestLink{
- Name: "REVISION",
- ID: []byte(rb.SourceStamp.Revision.Label),
- })
+ revisionBytes, err := hex.DecodeString(rb.SourceStamp.Revision.Label)
+ if err != nil {
+ logging.WithError(err).Warningf(c, "bad revision (not hex-decodable)")
+ } else {
+ bs.Manifests = append(bs.Manifests, model.ManifestLink{
+ Name: "REVISION",
+ ID: []byte(rb.SourceStamp.Revision.Label),
+ })
+ consoles, err := common.GetConsolesForBuilder(c, bs.BuilderID)
+ if err != nil {
+ return err
+ }
+ for _, con := range consoles {
+ // HACK(iannucci): Until we have real manifest support, console
+ // definitions will specify their manifest as "REVISION", and we'll do
+ // lookups with null URL fields.
+ bs.AddManifestRevisionIndex(
+ con.ProjectID, con.Console.Name, "REVISION", "", revisionBytes)
+ }
+ }
}
if rb.SourceStamp.Changelist != nil {
bs.Patches = append(bs.Patches, model.PatchInfo{
@@ -303,4 +324,5 @@ func (rb *MiloBuild) SummarizeTo(bs *model.BuildSummary) {
})
}
}
+ return nil
}
« no previous file with comments | « common/proto/milo/annotations.pb.go ('k') | milo/buildsource/buildbot/pubsub.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698