diff options
| author | Taras Madan <tarasmadan@google.com> | 2024-07-25 14:10:10 +0200 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2024-07-25 12:23:35 +0000 |
| commit | 32fcf98fda0484949d799e870d7ac9945c695932 (patch) | |
| tree | cb29723f7f60fd29fe7044e2668cdb46a1642734 /dashboard/app/coverage_batch.go | |
| parent | 466a14e57d3bc8a62b9bed144a554a19c20e88ab (diff) | |
dashboard/app: support scopes for batch jobs
Diffstat (limited to 'dashboard/app/coverage_batch.go')
| -rw-r--r-- | dashboard/app/coverage_batch.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/dashboard/app/coverage_batch.go b/dashboard/app/coverage_batch.go index d60f10eb4..1e87ef127 100644 --- a/dashboard/app/coverage_batch.go +++ b/dashboard/app/coverage_batch.go @@ -54,7 +54,8 @@ func handleBatchCoverage(w http.ResponseWriter, r *http.Request) { ctx, nsConfig.Coverage.BatchProject, nsConfig.Coverage.BatchServiceAccount, - batchScript(ns, repo, branch, 7, dates)); err != nil { + batchScript(ns, repo, branch, 7, dates), + nsConfig.Coverage.BatchScopes); err != nil { log.Errorf(ctx, "failed to batchScript(): %s", err.Error()) } } @@ -80,7 +81,7 @@ func batchScript(ns, repo, branch string, days int, datesTo []civil.Date) string } // from https://cloud.google.com/batch/docs/samples/batch-create-script-job -func createScriptJob(ctx context.Context, projectID, serviceAccount, script string) error { +func createScriptJob(ctx context.Context, projectID, serviceAccount, script string, scopes []string) error { region := "us-central1" jobName := fmt.Sprintf("coverage-merge-%s", uuid.New().String()) @@ -126,7 +127,8 @@ func createScriptJob(ctx context.Context, projectID, serviceAccount, script stri }, }}, ServiceAccount: &batchpb.ServiceAccount{ - Email: serviceAccount, + Email: serviceAccount, + Scopes: scopes, }, } |
