| Index: milo/appengine/swarming/build.go
|
| diff --git a/milo/appengine/swarming/build.go b/milo/appengine/swarming/build.go
|
| index 7c41c8d89694e610ea5782c0bd661f9d40810223..cf38a550233ece5fe750306111654c9429871fed 100644
|
| --- a/milo/appengine/swarming/build.go
|
| +++ b/milo/appengine/swarming/build.go
|
| @@ -73,6 +73,7 @@ func getSwarmingClient(c context.Context, server string) (*swarming.Service, err
|
| type swarmingService interface {
|
| getHost() string
|
| getSwarmingResult(c context.Context, taskID string) (*swarming.SwarmingRpcsTaskResult, error)
|
| + getSwarmingRequest(c context.Context, taskID string) (*swarming.SwarmingRpcsTaskRequest, error)
|
| getTaskOutput(c context.Context, taskID string) (string, error)
|
| }
|
|
|
| @@ -106,7 +107,14 @@ func (svc *prodSwarmingService) getTaskOutput(c context.Context, taskID string)
|
| return stdout.Output, nil
|
| }
|
|
|
| +func (svc *prodSwarmingService) getSwarmingRequest(c context.Context, taskID string) (*swarming.SwarmingRpcsTaskRequest, error) {
|
| + return svc.client.Task.Request(taskID).Context(c).Do()
|
| +}
|
| +
|
| type swarmingFetch struct {
|
| + fetchReq bool
|
| + req *swarming.SwarmingRpcsTaskRequest
|
| +
|
| fetchRes bool
|
| res *swarming.SwarmingRpcsTaskResult
|
|
|
| @@ -122,6 +130,13 @@ type swarmingFetch struct {
|
| // errNotMiloJob.
|
| func (f *swarmingFetch) get(c context.Context, svc swarmingService, taskID string) error {
|
| err := parallel.FanOutIn(func(workC chan<- func() error) {
|
| + if f.fetchReq {
|
| + workC <- func() (err error) {
|
| + f.req, err = svc.getSwarmingRequest(c, taskID)
|
| + return
|
| + }
|
| + }
|
| +
|
| if f.fetchRes {
|
| workC <- func() (err error) {
|
| f.res, err = svc.getSwarmingResult(c, taskID)
|
| @@ -142,6 +157,10 @@ func (f *swarmingFetch) get(c context.Context, svc swarmingService, taskID strin
|
|
|
| // Current ACL implementation: error if this is not a Milo job.
|
| switch {
|
| + case f.fetchReq:
|
| + if !isMiloJob(f.req.Tags) {
|
| + return errNotMiloJob
|
| + }
|
| case f.fetchRes:
|
| if !isMiloJob(f.res.Tags) {
|
| return errNotMiloJob
|
|
|