| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Dispatcher usage: | 5 // Dispatcher usage: |
| 6 // go run infra/monitoring/dispatcher | 6 // go run infra/monitoring/dispatcher |
| 7 // Expects gatekeeper.json to be in the current directory. | 7 // Expects gatekeeper.json to be in the current directory. |
| 8 | 8 |
| 9 package main | 9 package main |
| 10 | 10 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 flag.Parse() | 225 flag.Parse() |
| 226 | 226 |
| 227 authOptions := auth.Options{ | 227 authOptions := auth.Options{ |
| 228 ServiceAccountJSONPath: *serviceAccountJSON, | 228 ServiceAccountJSONPath: *serviceAccountJSON, |
| 229 Scopes: []string{ | 229 Scopes: []string{ |
| 230 auth.OAuthScopeEmail, | 230 auth.OAuthScopeEmail, |
| 231 "https://www.googleapis.com/auth/projecthosting", | 231 "https://www.googleapis.com/auth/projecthosting", |
| 232 }, | 232 }, |
| 233 } | 233 } |
| 234 | 234 |
| 235 » mode := auth.SilentLogin | 235 » mode := auth.OptionalLogin |
| 236 if *login { | 236 if *login { |
| 237 mode = auth.InteractiveLogin | 237 mode = auth.InteractiveLogin |
| 238 } | 238 } |
| 239 | 239 |
| 240 transport, err := auth.NewAuthenticator(mode, authOptions).Transport() | 240 transport, err := auth.NewAuthenticator(mode, authOptions).Transport() |
| 241 if err != nil { | 241 if err != nil { |
| 242 log.Errorf("AuthenticatedTransport: %v", err) | 242 log.Errorf("AuthenticatedTransport: %v", err) |
| 243 if !*login { | 243 if !*login { |
| 244 log.Errorf("Consider re-running with -login") | 244 log.Errorf("Consider re-running with -login") |
| 245 } | 245 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 logging.Set(ctx, log) | 361 logging.Set(ctx, log) |
| 362 defer cancel() | 362 defer cancel() |
| 363 | 363 |
| 364 loopResults := looper.Run(ctx, f, cycle, *maxErrs, clock.GetSystemClock(
)) | 364 loopResults := looper.Run(ctx, f, cycle, *maxErrs, clock.GetSystemClock(
)) |
| 365 | 365 |
| 366 if !loopResults.Success { | 366 if !loopResults.Success { |
| 367 log.Errorf("Failed to run loop, %v errors", loopResults.Errs) | 367 log.Errorf("Failed to run loop, %v errors", loopResults.Errs) |
| 368 os.Exit(1) | 368 os.Exit(1) |
| 369 } | 369 } |
| 370 } | 370 } |
| OLD | NEW |