| OLD | NEW |
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. | 1 // Copyright 2017 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 package buildbucket | 5 package buildbucket |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "encoding/json" | 8 "encoding/json" |
| 9 "errors" | 9 "errors" |
| 10 "fmt" | 10 "fmt" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return nil, errors.New("no swarming hostname tag") | 92 return nil, errors.New("no swarming hostname tag") |
| 93 } | 93 } |
| 94 if task, ok = tags["swarming_task_id"]; !ok { | 94 if task, ok = tags["swarming_task_id"]; !ok { |
| 95 return nil, errors.New("no swarming task id") | 95 return nil, errors.New("no swarming task id") |
| 96 } | 96 } |
| 97 swarmingSvc, err := swarming.NewProdService(c, host) | 97 swarmingSvc, err := swarming.NewProdService(c, host) |
| 98 if err != nil { | 98 if err != nil { |
| 99 return nil, err | 99 return nil, err |
| 100 } | 100 } |
| 101 bl := swarming.BuildLoader{} | 101 bl := swarming.BuildLoader{} |
| 102 » // The linkBase is not necessary for the summary. | 102 » return bl.SwarmingBuildImpl(c, swarmingSvc, task) |
| 103 » return bl.SwarmingBuildImpl(c, swarmingSvc, "", task) | |
| 104 } | 103 } |
| 105 | 104 |
| 106 // processBuild queries swarming and logdog for annotation data, then adds or | 105 // processBuild queries swarming and logdog for annotation data, then adds or |
| 107 // updates a buildEntry in datastore. | 106 // updates a buildEntry in datastore. |
| 108 func processBuild( | 107 func processBuild( |
| 109 c context.Context, host string, build *bucketApi.ApiCommonBuildMessage)
( | 108 c context.Context, host string, build *bucketApi.ApiCommonBuildMessage)
( |
| 110 *buildEntry, error) { | 109 *buildEntry, error) { |
| 111 | 110 |
| 112 now := clock.Now(c).UTC() | 111 now := clock.Now(c).UTC() |
| 113 entry := buildEntry{key: buildEntryKey(host, build.Id)} | 112 entry := buildEntry{key: buildEntryKey(host, build.Id)} |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 logging.WithError(err).Errorf(c, "could not parse pubsub message
string") | 227 logging.WithError(err).Errorf(c, "could not parse pubsub message
string") |
| 229 return err | 228 return err |
| 230 } | 229 } |
| 231 if err := json.Unmarshal(bData, &data); err != nil { | 230 if err := json.Unmarshal(bData, &data); err != nil { |
| 232 logging.WithError(err).Errorf(c, "could not parse pubsub message
data") | 231 logging.WithError(err).Errorf(c, "could not parse pubsub message
data") |
| 233 return err | 232 return err |
| 234 } | 233 } |
| 235 | 234 |
| 236 return handlePubSubBuild(c, &data) | 235 return handlePubSubBuild(c, &data) |
| 237 } | 236 } |
| OLD | NEW |