| 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 "fmt" | 9 "fmt" |
| 10 "net/http" | 10 "net/http" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 if err != nil { | 148 if err != nil { |
| 149 return err | 149 return err |
| 150 } | 150 } |
| 151 status, err := parseStatus(build) | 151 status, err := parseStatus(build) |
| 152 if err != nil { | 152 if err != nil { |
| 153 return err | 153 return err |
| 154 } | 154 } |
| 155 // TODO(hinoka): Console related items. | 155 // TODO(hinoka): Console related items. |
| 156 bs := model.BuildSummary{ | 156 bs := model.BuildSummary{ |
| 157 BuildKey: key, | 157 BuildKey: key, |
| 158 SelfLink: build.Url, |
| 158 BuilderID: fmt.Sprintf("buildbucket/%s/%s", build.Bucket, builde
rName), | 159 BuilderID: fmt.Sprintf("buildbucket/%s/%s", build.Bucket, builde
rName), |
| 159 Created: parseTimestamp(build.CreatedTs), | 160 Created: parseTimestamp(build.CreatedTs), |
| 160 Summary: model.Summary{ | 161 Summary: model.Summary{ |
| 161 Status: status, | 162 Status: status, |
| 162 Start: parseTimestamp(build.StartedTs), | 163 Start: parseTimestamp(build.StartedTs), |
| 163 }, | 164 }, |
| 164 } | 165 } |
| 165 if entry.respBuild != nil { | 166 if entry.respBuild != nil { |
| 166 // Add info from the respBuild into the build summary if we have
the data. | 167 // Add info from the respBuild into the build summary if we have
the data. |
| 167 if err := entry.respBuild.SummarizeTo(c, &bs); err != nil { | 168 if err := entry.respBuild.SummarizeTo(c, &bs); err != nil { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 logging.WithError(err).Errorf(c, "could not parse pubsub message
string") | 231 logging.WithError(err).Errorf(c, "could not parse pubsub message
string") |
| 231 return err | 232 return err |
| 232 } | 233 } |
| 233 if err := json.Unmarshal(bData, &data); err != nil { | 234 if err := json.Unmarshal(bData, &data); err != nil { |
| 234 logging.WithError(err).Errorf(c, "could not parse pubsub message
data") | 235 logging.WithError(err).Errorf(c, "could not parse pubsub message
data") |
| 235 return err | 236 return err |
| 236 } | 237 } |
| 237 | 238 |
| 238 return handlePubSubBuild(c, &data) | 239 return handlePubSubBuild(c, &data) |
| 239 } | 240 } |
| OLD | NEW |