| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. |
| 4 |
| 5 package model |
| 6 |
| 7 import ( |
| 8 "time" |
| 9 |
| 10 "github.com/luci/gae/service/datastore" |
| 11 ) |
| 12 |
| 13 // BuildSummary is a datastore model which is used for storing staandardized |
| 14 // summarized build data, and is used for backend-agnostic views (i.e. builders, |
| 15 // console). It contains only data that: |
| 16 // * is necessary to render these simplified views |
| 17 // * is present in all implementations (buildbot, buildbucket) |
| 18 // |
| 19 // This entity will live as a child of the various implementation's |
| 20 // representations of a build (e.g. buildbotBuild). It has various 'tag' fields |
| 21 // so that it can be queried by the various backend-agnostic views. |
| 22 type BuildSummary struct { |
| 23 // _id for a BuildSummary is always 1 |
| 24 _ int64 `gae:"$id,1"` |
| 25 |
| 26 // BuildKey will always point to the "real" build, i.e. a buildbotBuild
or |
| 27 // a buildbucketBuild. It is always the parent key for the BuildSummary. |
| 28 BuildKey *datastore.Key `gae:"$parent"` |
| 29 |
| 30 // Global identifier for the builder that this Build belongs to, i.e.: |
| 31 // "buildbot/<mastername>/<buildername>" |
| 32 // "buildbucket/<bucketname>/<buildername>" |
| 33 BuilderID string |
| 34 |
| 35 // KnownConsoleHash is used for backfilling and must always equal the ra
w |
| 36 // value of: |
| 37 // |
| 38 // sha256(sorted(ConsoleEpochs.keys()) |
| 39 // |
| 40 // This is used to identify BuildSummaries which haven't yet been includ
ed in |
| 41 // some new Console definition (or which have been removed from a Consol
e |
| 42 // definition). |
| 43 KnownConsoleHash []byte |
| 44 |
| 45 // ConsoleEpochs is used for backfilling, and is a series of cmpbin tupl
es: |
| 46 // |
| 47 // (console_name[str], recorded_epoch[int]) |
| 48 // |
| 49 // This maps which epoch (version) of a console definition this BuildSum
mary |
| 50 // belongs to. Whenever a console definition changes, its epoch increase
s. The |
| 51 // backfiller will then identify BuildSummary objects which are out of d
ate |
| 52 // and update them. |
| 53 ConsoleEpochs [][]byte |
| 54 |
| 55 // ConsoleTags contains query tags for the console view. These are cmpbi
n |
| 56 // tuples which look like: |
| 57 // |
| 58 // (console_name[str], sort_criteria[tuple], sort_values[tuple]) |
| 59 // |
| 60 // `sort_criteria` are defined by the console definition, and will likel
y look |
| 61 // like (manifest_name[str], repo_url[str]), but other sort_criteria may
be |
| 62 // added later. |
| 63 // |
| 64 // `sort_values` are defined by the selected sort_criteria, and will lik
ely |
| 65 // look like (commit_revision[str],). In any event, this string is opaqu
e and |
| 66 // only to be used by the console itself. |
| 67 ConsoleTags [][]byte |
| 68 |
| 69 // Created is the time when the Build was first created. Due to pending |
| 70 // queues, this may be substantially before Summary.Start. |
| 71 Created time.Time |
| 72 |
| 73 // Summary summarizes relevant bits about the overall build. |
| 74 Summary Summary |
| 75 |
| 76 // CurrentStep summarizes relevant bits about the currently running step
(if |
| 77 // any). Only expected to be set if !Summary.Status.Terminal(). |
| 78 CurrentStep Summary |
| 79 |
| 80 // Manifests is a list of links to source manifests that this build repo
rted. |
| 81 Manifests []ManifestLink |
| 82 |
| 83 // Patches is the list of patches which are associated with this build. |
| 84 // We reserve the multi-patch case for advanced (multi-repo) tryjobs... |
| 85 // Typically there will only be one patch associated with a build. |
| 86 Patches []PatchInfo |
| 87 } |
| OLD | NEW |