From 32fcf98fda0484949d799e870d7ac9945c695932 Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Thu, 25 Jul 2024 14:10:10 +0200 Subject: dashboard/app: support scopes for batch jobs --- dashboard/app/coverage_batch.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'dashboard/app/coverage_batch.go') 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, }, } -- cgit mrf-deployment