From ec20f94ff6effe4c2aab4b4a4ecdfb33180e6e77 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 11 Jul 2025 15:44:40 +0200 Subject: syz-cluster: upload and share build config and log --- syz-cluster/dashboard/handler.go | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'syz-cluster/dashboard/handler.go') diff --git a/syz-cluster/dashboard/handler.go b/syz-cluster/dashboard/handler.go index f6c9b3e3b..794feba83 100644 --- a/syz-cluster/dashboard/handler.go +++ b/syz-cluster/dashboard/handler.go @@ -22,6 +22,7 @@ import ( type dashboardHandler struct { title string + buildRepo *db.BuildRepository seriesRepo *db.SeriesRepository sessionRepo *db.SessionRepository sessionTestRepo *db.SessionTestRepository @@ -37,7 +38,8 @@ func newHandler(env *app.AppEnvironment) (*dashboardHandler, error) { perFile := map[string]*template.Template{} var err error for _, name := range []string{"index.html", "series.html"} { - perFile[name], err = template.ParseFS(templates, "templates/base.html", "templates/"+name) + perFile[name], err = template.ParseFS(templates, + "templates/base.html", "templates/templates.html", "templates/"+name) if err != nil { return nil, err } @@ -46,6 +48,7 @@ func newHandler(env *app.AppEnvironment) (*dashboardHandler, error) { title: env.Config.Name, templates: perFile, blobStorage: env.BlobStorage, + buildRepo: db.NewBuildRepository(env.Spanner), seriesRepo: db.NewSeriesRepository(env.Spanner), sessionRepo: db.NewSessionRepository(env.Spanner), sessionTestRepo: db.NewSessionTestRepository(env.Spanner), @@ -65,6 +68,7 @@ func (h *dashboardHandler) Mux() *http.ServeMux { mux.HandleFunc("/series/{id}", errToStatus(h.seriesInfo)) mux.HandleFunc("/patches/{id}", errToStatus(h.patchContent)) mux.HandleFunc("/findings/{id}/{key}", errToStatus(h.findingInfo)) + mux.HandleFunc("/builds/{id}/{key}", errToStatus(h.buildInfo)) mux.HandleFunc("/", errToStatus(h.seriesList)) staticFiles, err := fs.Sub(staticFs, "static") if err != nil { @@ -290,6 +294,23 @@ func (h *dashboardHandler) findingInfo(w http.ResponseWriter, r *http.Request) e } } +func (h *dashboardHandler) buildInfo(w http.ResponseWriter, r *http.Request) error { + build, err := h.buildRepo.GetByID(r.Context(), r.PathValue("id")) + if err != nil { + return err + } else if build == nil { + return fmt.Errorf("%w: build", errNotFound) + } + switch r.PathValue("key") { + case "log": + return h.streamBlob(w, build.LogURI) + case "config": + return h.streamBlob(w, build.ConfigURI) + default: + return fmt.Errorf("%w: unknown key value", errBadRequest) + } +} + func (h *dashboardHandler) sessionTestLog(w http.ResponseWriter, r *http.Request) error { test, err := h.sessionTestRepo.Get(r.Context(), r.PathValue("id"), r.FormValue("name")) if err != nil { -- cgit mrf-deployment