diff options
| author | Taras Madan <tarasmadan@google.com> | 2024-07-25 15:20:28 +0200 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2024-07-25 15:10:23 +0000 |
| commit | 3f86dfedab01e62e34121865cebb1ce1efcfea0d (patch) | |
| tree | e389f048fde548442bc077c48be1cef1fb417e69 | |
| parent | 4d77b9fe7da3d014943a16cb4b9a4ca3a531521a (diff) | |
dashboard/app: add init scripts for batch processing
| -rw-r--r-- | dashboard/app/config.go | 2 | ||||
| -rw-r--r-- | dashboard/app/coverage_batch.go | 20 |
2 files changed, 15 insertions, 7 deletions
diff --git a/dashboard/app/config.go b/dashboard/app/config.go index 36e06fc98..5f4461f91 100644 --- a/dashboard/app/config.go +++ b/dashboard/app/config.go @@ -129,6 +129,8 @@ type CoverageConfig struct { BatchProject string BatchServiceAccount string BatchScopes []string + JobInitScript string + SyzEnvInitScript string } // DiscussionEmailConfig defines the correspondence between an email and a DiscussionSource. diff --git a/dashboard/app/coverage_batch.go b/dashboard/app/coverage_batch.go index 1e87ef127..8a88efa80 100644 --- a/dashboard/app/coverage_batch.go +++ b/dashboard/app/coverage_batch.go @@ -50,22 +50,28 @@ func handleBatchCoverage(w http.ResponseWriter, r *http.Request) { log.Infof(ctx, "there is no new coverage for merging available in %s", ns) continue } + nsCovConfig := nsConfig.Coverage if err := createScriptJob( ctx, - nsConfig.Coverage.BatchProject, - nsConfig.Coverage.BatchServiceAccount, - batchScript(ns, repo, branch, 7, dates), - nsConfig.Coverage.BatchScopes); err != nil { - log.Errorf(ctx, "failed to batchScript(): %s", err.Error()) + nsCovConfig.BatchProject, + nsCovConfig.BatchServiceAccount, + batchScript(ns, repo, branch, 7, dates, nsCovConfig.JobInitScript, nsCovConfig.SyzEnvInitScript), + nsCovConfig.BatchScopes); err != nil { + log.Errorf(ctx, "failed to batchScript: %s", err.Error()) } } } -func batchScript(ns, repo, branch string, days int, datesTo []civil.Date) string { - script := "git clone --depth 1 --branch master --single-branch https://github.com/google/syzkaller\n" + +func batchScript(ns, repo, branch string, days int, datesTo []civil.Date, + jobInitScript, syzEnvInitScript string) string { + script := jobInitScript + "\n" + script += "git clone --depth 1 --branch master --single-branch https://github.com/google/syzkaller\n" + "cd syzkaller\n" + "export CI=1\n" + "./tools/syz-env \"" + if syzEnvInitScript != "" { + script += syzEnvInitScript + "; " + } for _, dateTo := range datesTo { script += "./tools/syz-bq.sh" + " -w ../workdir-cover-aggregation/" + |
