| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 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 swarming | 5 package swarming |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bytes" | 8 "bytes" |
| 9 "encoding/json" | 9 "encoding/json" |
| 10 "fmt" | 10 "fmt" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 switch sr.State { | 213 switch sr.State { |
| 214 case TaskRunning: | 214 case TaskRunning: |
| 215 build.Summary.Status = resp.Running | 215 build.Summary.Status = resp.Running |
| 216 | 216 |
| 217 case TaskPending: | 217 case TaskPending: |
| 218 build.Summary.Status = resp.NotRun | 218 build.Summary.Status = resp.NotRun |
| 219 | 219 |
| 220 case TaskExpired, TaskTimedOut, TaskBotDied: | 220 case TaskExpired, TaskTimedOut, TaskBotDied: |
| 221 build.Summary.Status = resp.InfraFailure | 221 build.Summary.Status = resp.InfraFailure |
| 222 switch sr.State { |
| 223 case TaskExpired: |
| 224 build.Summary.Text = append(build.Summary.Text, "Task ex
pired") |
| 225 case TaskTimedOut: |
| 226 build.Summary.Text = append(build.Summary.Text, "Task ti
med out") |
| 227 case TaskBotDied: |
| 228 build.Summary.Text = append(build.Summary.Text, "Bot die
d") |
| 229 } |
| 222 | 230 |
| 223 case TaskCanceled: | 231 case TaskCanceled: |
| 224 // Cancelled build is user action, so it is not an infra failure
. | 232 // Cancelled build is user action, so it is not an infra failure
. |
| 225 build.Summary.Status = resp.Failure | 233 build.Summary.Status = resp.Failure |
| 234 build.Summary.Text = append(build.Summary.Text, "Task cancelled
by user") |
| 226 | 235 |
| 227 case TaskCompleted: | 236 case TaskCompleted: |
| 228 | 237 |
| 229 switch { | 238 switch { |
| 230 case sr.InternalFailure: | 239 case sr.InternalFailure: |
| 231 build.Summary.Status = resp.InfraFailure | 240 build.Summary.Status = resp.InfraFailure |
| 232 case sr.Failure: | 241 case sr.Failure: |
| 233 build.Summary.Status = resp.Failure | 242 build.Summary.Status = resp.Failure |
| 234 default: | 243 default: |
| 235 build.Summary.Status = resp.Success | 244 build.Summary.Status = resp.Success |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 // Supports server aliases. | 364 // Supports server aliases. |
| 356 func taskPageURL(swarmingHostname, taskID string) string { | 365 func taskPageURL(swarmingHostname, taskID string) string { |
| 357 return fmt.Sprintf("https://%s/user/task/%s", resolveServer(swarmingHost
name), taskID) | 366 return fmt.Sprintf("https://%s/user/task/%s", resolveServer(swarmingHost
name), taskID) |
| 358 } | 367 } |
| 359 | 368 |
| 360 // botPageURL returns a URL to a human-consumable page of a swarming bot. | 369 // botPageURL returns a URL to a human-consumable page of a swarming bot. |
| 361 // Supports server aliases. | 370 // Supports server aliases. |
| 362 func botPageURL(swarmingHostname, botID string) string { | 371 func botPageURL(swarmingHostname, botID string) string { |
| 363 return fmt.Sprintf("https://%s/restricted/bot/%s", resolveServer(swarmin
gHostname), botID) | 372 return fmt.Sprintf("https://%s/restricted/bot/%s", resolveServer(swarmin
gHostname), botID) |
| 364 } | 373 } |
| OLD | NEW |