| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. | 1 // Copyright 2016 The LUCI Authors. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 b.Currentstep = nil | 224 b.Currentstep = nil |
| 225 b.Text = append(b.Text, "Build expired on Milo") | 225 b.Text = append(b.Text, "Build expired on Milo") |
| 226 return datastore.Put(c, b) | 226 return datastore.Put(c, b) |
| 227 } | 227 } |
| 228 | 228 |
| 229 // saveBuildSummary summerizes a build into a model.BuildSummary and then saves
it. | 229 // saveBuildSummary summerizes a build into a model.BuildSummary and then saves
it. |
| 230 func saveBuildSummary(c context.Context, b *buildbotBuild) error { | 230 func saveBuildSummary(c context.Context, b *buildbotBuild) error { |
| 231 resp := renderBuild(c, b) | 231 resp := renderBuild(c, b) |
| 232 bs := model.BuildSummary{ | 232 bs := model.BuildSummary{ |
| 233 BuildKey: datastore.KeyForObj(c, b), | 233 BuildKey: datastore.KeyForObj(c, b), |
| 234 SelfLink: fmt.Sprintf("/buildbot/%s/%s/%d", b.Master, b.Builder
name, b.Number), |
| 234 BuilderID: fmt.Sprintf("buildbot/%s/%s", b.Master, b.Buildername
), | 235 BuilderID: fmt.Sprintf("buildbot/%s/%s", b.Master, b.Buildername
), |
| 235 } | 236 } |
| 236 if err := resp.SummarizeTo(c, &bs); err != nil { | 237 if err := resp.SummarizeTo(c, &bs); err != nil { |
| 237 return err | 238 return err |
| 238 } | 239 } |
| 239 return datastore.Put(c, &bs) | 240 return datastore.Put(c, &bs) |
| 240 } | 241 } |
| 241 | 242 |
| 242 func doMaster(c context.Context, master *buildbotMaster, internal bool) int { | 243 func doMaster(c context.Context, master *buildbotMaster, internal bool) int { |
| 243 // Store the master json into the datastore. | 244 // Store the master json into the datastore. |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 428 |
| 428 } | 429 } |
| 429 if master != nil { | 430 if master != nil { |
| 430 code := doMaster(c, master, internal) | 431 code := doMaster(c, master, internal) |
| 431 if code != 0 { | 432 if code != 0 { |
| 432 return code | 433 return code |
| 433 } | 434 } |
| 434 } | 435 } |
| 435 return http.StatusOK | 436 return http.StatusOK |
| 436 } | 437 } |
| OLD | NEW |