 Chromium Code Reviews
 Chromium Code Reviews Issue 2944633003:
  [milo] Add BuildSummary and common models.  (Closed)
    
  
    Issue 2944633003:
  [milo] Add BuildSummary and common models.  (Closed) 
  | Index: milo/appengine/common/model/build_summary.go | 
| diff --git a/milo/appengine/common/model/build_summary.go b/milo/appengine/common/model/build_summary.go | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..c394155a7efe638c992f08dfbf1517e7b2301106 | 
| --- /dev/null | 
| +++ b/milo/appengine/common/model/build_summary.go | 
| @@ -0,0 +1,65 @@ | 
| +// Copyright 2017 The LUCI Authors. All rights reserved. | 
| +// Use of this source code is governed under the Apache License, Version 2.0 | 
| +// that can be found in the LICENSE file. | 
| + | 
| +package model | 
| + | 
| +import ( | 
| + "time" | 
| + | 
| + "github.com/luci/gae/service/datastore" | 
| +) | 
| + | 
| +// BuildSummary is a datastore model which is used for displaying | 
| 
Ryan Tseng
2017/06/17 00:44:28
s/displaying/storing summarized data for/
 
iannucci
2017/06/17 01:30:04
Done.
 | 
| +// backend-agnostic views (i.e. builders, console). It contains only data that: | 
| +// * is necessary to render these simplified views | 
| +// * is present in all implementations (buildbot, buildbucket) | 
| +// | 
| +// This entity will live as a child of the various implementation's | 
| +// representations of a build (e.g. buildbotBuild). It has various 'tag' fields | 
| +// so that it can be queried by the various backend-agnostic views. | 
| +type BuildSummary struct { | 
| + // _id for a BuildSummary is always 1 | 
| 
Ryan Tseng
2017/06/17 00:44:28
Why? What is this for?
 
iannucci
2017/06/17 01:30:04
This is part of the key that luci/gae will generat
 | 
| + _ int64 `gae:"$id,1"` | 
| + | 
| + // BuildKey will always point to the "real" build, i.e. a buildbotBuild or | 
| + // a buildbucketBuild. It is always the parent key for the BuildSummary. | 
| + BuildKey *datastore.Key `gae:"$parent"` | 
| + | 
| + // Global identifier for the builder that this Build belongs to, i.e.: | 
| + // "buildbot/<mastername>/<buildername>" | 
| + // "buildbucket/<bucketname>/<buildername>" | 
| + BuilderID string | 
| + | 
| + // KnownConsoleHash is used for backfilling and must always equal | 
| + // sha256(sorted(ConsoleEpochs.keys()) | 
| 
Ryan Tseng
2017/06/17 00:44:28
Is this a binary representation (instead of a hex
 
iannucci
2017/06/17 01:30:04
I tend to prefer the raw representation (since it'
 | 
| + KnownConsoleHash []byte | 
| + | 
| + // ConsoleEpochs is used for backfilling, and is a series of cmpbin tuples: | 
| + // (console_name[str], recorded_epoch[int]) | 
| 
Ryan Tseng
2017/06/17 00:44:28
// When a new console definition appears, this det
 
iannucci
2017/06/17 01:30:04
Done.
 | 
| + ConsoleEpochs [][]byte | 
| + | 
| + // ConsoleTags contains query tags for the console view. These are cmpbin | 
| + // tuples which look like: | 
| + // (console_name[str], sort_criteria[tuple], sort_values[tuple]) | 
| 
Ryan Tseng
2017/06/17 00:44:28
Explain sort_criteria[tuple] and sort_values[tuple
 
iannucci
2017/06/17 01:30:04
Done.
 | 
| + ConsoleTags [][]byte | 
| + | 
| + // Created is the time when the Build was first created. Due to pending | 
| + // queues, this may be substantially before Summary.Start. | 
| + Created time.Time | 
| + | 
| + // Summary summarizes relevant bits about the overall build. | 
| + Summary Summary | 
| + | 
| + // CurrentStep summarizes relevant bits about the currently running step (if | 
| + // any). Only expected to be set if !Summary.Status.Terminal(). | 
| + CurrentStep Summary | 
| + | 
| + // Manifests is a list of links to source manifests that this build reported. | 
| + Manifests []ManifestLink | 
| + | 
| + // Patches is the list of patches which are associated with this build. | 
| + // We reserve the multi-patch case for advanced (multi-repo) tryjobs... | 
| + // Typically there will only be one patch associated with a build. | 
| + Patches []PatchInfo | 
| +} |