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

Side by Side Diff: milo/buildsource/buildbucket/struct.go

Issue 2964143002: Buildbucket: Save buildbucket build info and summary on pubsub push (Closed)
Patch Set: Rebase & Fixes 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
« no previous file with comments | « milo/buildsource/buildbucket/pubsub.go ('k') | milo/buildsource/swarming/build.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 buildbucket
6
7 import (
8 "encoding/json"
9 "fmt"
10 "time"
11
12 bucketApi "github.com/luci/luci-go/common/api/buildbucket/buildbucket/v1 "
13 "github.com/luci/luci-go/milo/api/resp"
14 )
15
16 type buildEntry struct {
17 // key is formulated via <project ID>:<build ID>. From PubSub, project ID
18 // is determined via the topic name.
19 key string `gae:$id`
20
21 // buildData is the json marshalled form of
22 // a bucketApi.ApiCommonBuildMessage message.
23 buildbucketData []byte `gae:,noindex`
Ryan Tseng 2017/07/11 00:04:41 This would be useful as a broken out as a native s
24
25 // respBuild is the resp.MiloBuild representation of the build.
26 respBuild *resp.MiloBuild `gae:,noindex`
27
28 // project is the luci project name of the build.
29 project string
30
31 // created is the time when this build entry was first created.
32 created time.Time
33
34 // last is the time when this build entry was last modified.
35 modified time.Time
36 }
37
38 // buildEntryKey returns the key for a build entry given a hostname and build ID .
39 func buildEntryKey(host string, buildID int64) string {
40 return fmt.Sprintf("%s:%d", host, buildID)
41 }
42
43 func (b *buildEntry) getBuild() (*bucketApi.ApiCommonBuildMessage, error) {
44 msg := bucketApi.ApiCommonBuildMessage{}
45 err := json.Unmarshal(b.buildbucketData, &msg)
46 return &msg, err
47 }
OLDNEW
« no previous file with comments | « milo/buildsource/buildbucket/pubsub.go ('k') | milo/buildsource/swarming/build.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698