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

Side by Side Diff: milo/api/resp/build.go

Issue 2964143002: Buildbucket: Save buildbucket build info and summary on pubsub push (Closed)
Patch Set: comment 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 //go:generate stringer -type=Verbosity 5 //go:generate stringer -type=Verbosity
6 //go:generate stringer -type=ComponentType 6 //go:generate stringer -type=ComponentType
7 7
8 package resp 8 package resp
9 9
10 import ( 10 import (
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 Alt string `json:",omitempty"` 250 Alt string `json:",omitempty"`
251 251
252 // Alias, if true, means that this link is an [alias link]. 252 // Alias, if true, means that this link is an [alias link].
253 Alias bool `json:",omitempty"` 253 Alias bool `json:",omitempty"`
254 } 254 }
255 255
256 // NewLink does just about what you'd expect. 256 // NewLink does just about what you'd expect.
257 func NewLink(label, url string) *Link { 257 func NewLink(label, url string) *Link {
258 return &Link{Link: model.Link{Label: label, URL: url}} 258 return &Link{Link: model.Link{Label: label, URL: url}}
259 } 259 }
260
261 func (comp *BuildComponent) toModelSummary() model.Summary {
262 return model.Summary{
263 Status: comp.Status,
264 Start: comp.Started,
265 End: comp.Finished,
266 Text: comp.Text,
267 }
268 }
269
270 // SummarizeTo summarizes the data into a given model.BuildSummary.
271 func (rb *MiloBuild) SummarizeTo(bs *model.BuildSummary) {
iannucci 2017/07/11 21:51:20 I'm not sure if this makes sense as a function of
Ryan Tseng 2017/07/11 23:09:22 Yeah, this is meant to fill in extra information i
272 bs.Summary = rb.Summary.toModelSummary()
273 if rb.Summary.Status == model.Running {
274 // Assume the last step is the current step.
275 if len(rb.Components) > 0 {
276 cs := rb.Components[len(rb.Components)-1]
277 bs.CurrentStep = cs.toModelSummary()
278 }
279 }
280 if rb.SourceStamp != nil {
281 // TODO(hinoka): This should be full manifests, but lets just us e single
282 // revisions for now.
283 if rb.SourceStamp.Revision != nil {
284 bs.Manifests = append(bs.Manifests, model.ManifestLink{
285 Name: "REVISION",
286 ID: []byte(rb.SourceStamp.Revision.Label),
287 })
288 }
289 if rb.SourceStamp.Changelist != nil {
290 bs.Patches = append(bs.Patches, model.PatchInfo{
291 Link: rb.SourceStamp.Changelist.Link,
292 AuthorEmail: rb.SourceStamp.AuthorEmail,
293 })
294 }
295 }
296 }
OLDNEW
« no previous file with comments | « no previous file | milo/buildsource/buildbucket/pubsub.go » ('j') | milo/buildsource/buildbucket/pubsub.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698