From c819f2276e0861eaf83d155441072013ec914f3c Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Tue, 12 Nov 2024 11:17:28 +0100 Subject: dashboard/app: change tool name to db-export --- dashboard/app/batch_db_export.go | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 dashboard/app/batch_db_export.go (limited to 'dashboard/app/batch_db_export.go') diff --git a/dashboard/app/batch_db_export.go b/dashboard/app/batch_db_export.go new file mode 100644 index 000000000..9ca294d70 --- /dev/null +++ b/dashboard/app/batch_db_export.go @@ -0,0 +1,42 @@ +// Copyright 2024 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +package main + +import ( + "net/http" + + "cloud.google.com/go/batch/apiv1/batchpb" + "google.golang.org/appengine/v2" + "google.golang.org/appengine/v2/log" +) + +const exportTimeoutSeconds = 60 * 60 * 6 + +func handleBatchDBExport(w http.ResponseWriter, r *http.Request) { + ctx := appengine.NewContext(r) + for ns, nsConfig := range getConfig(ctx).Namespaces { + if nsConfig.ReproExportPath == "" { + continue + } + serviceAccount := &batchpb.ServiceAccount{ + Scopes: []string{"https://www.googleapis.com/auth/userinfo.email"}, + } + if err := createScriptJob(ctx, "syzkaller", "db-export", + exportDBScript(ns, nsConfig.ReproExportPath), exportTimeoutSeconds, serviceAccount); err != nil { + log.Errorf(ctx, "createScriptJob: %s", err.Error()) + } + } +} + +func exportDBScript(srcNamespace, archivePath string) string { + return "\n" + + "git clone -q --depth 1 --branch master --single-branch https://github.com/google/syzkaller\n" + + "cd syzkaller\n" + + "token=$(gcloud auth print-access-token)\n" + + "CI=1 ./tools/syz-env \"" + // CI=1 to suppress "The input device is not a TTY". + "go run ./tools/syz-db-export/... -namespace " + srcNamespace + " -output export -token $token -j 10 && " + + "tar -czf export.tar.gz ./export/ && " + + "gsutil -q -m cp export.tar.gz " + archivePath + + "\"" +} -- cgit mrf-deployment