aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/dashapi/dashapi.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2022-07-15 09:29:43 +0000
committerAleksandr Nogikh <wp32pw@gmail.com>2022-08-24 12:05:06 +0200
commit6db8af716fb0995966f00e2d52d2f3baa43ea868 (patch)
treea6c3c1d9713cc1393d6ceb4b64fa9e89f30bf4a2 /dashboard/dashapi/dashapi.go
parentb6ee202aee2a31a8a21e174548a39c54e3063f1c (diff)
dashboard: implement asset storage
Asset is a file/attachment relevant for debugging a kernel crash or the syzbot itself. Dashboard keeps track of the uploaded assets and manages their lifetime. Some of the assets are attached to the bug reports sent by syzkaller, some (like html coverage report) are displayed on the web portal. Two new API requests: * add_build_assets -- let dashboard remember one more build-related asset. * needed_assets -- query the list of assets that are still needed by the dashboard.
Diffstat (limited to 'dashboard/dashapi/dashapi.go')
-rw-r--r--dashboard/dashapi/dashapi.go49
1 files changed, 49 insertions, 0 deletions
diff --git a/dashboard/dashapi/dashapi.go b/dashboard/dashapi/dashapi.go
index 028448b33..cdefb8080 100644
--- a/dashboard/dashapi/dashapi.go
+++ b/dashboard/dashapi/dashapi.go
@@ -102,6 +102,7 @@ type Build struct {
KernelConfig []byte
Commits []string // see BuilderPoll
FixCommits []Commit
+ Assets []NewAsset
}
type Commit struct {
@@ -396,8 +397,27 @@ type BugReport struct {
PatchLink string
BisectCause *BisectResult
BisectFix *BisectResult
+ Assets []Asset
}
+type Asset struct {
+ Title string
+ DownloadURL string
+ Type AssetType
+}
+
+type AssetType string
+
+// Asset types used throughout the system.
+// DO NOT change them, this will break compatibility with DB content.
+const (
+ BootableDisk AssetType = "bootable_disk"
+ NonBootableDisk AssetType = "non_bootable_disk"
+ KernelObject AssetType = "kernel_object"
+ KernelImage AssetType = "kernel_image"
+ HTMLCoverageReport AssetType = "html_coverage_report"
+)
+
type BisectResult struct {
Commit *Commit // for conclusive bisection
Commits []*Commit // for inconclusive bisection
@@ -537,6 +557,35 @@ func (dash *Dashboard) UploadManagerStats(req *ManagerStatsReq) error {
return dash.Query("manager_stats", req, nil)
}
+// Asset lifetime:
+// 1. syz-ci uploads it to GCS and reports to the dashboard via add_build_asset.
+// 2. dashboard periodically checks if the asset is still needed.
+// 3. syz-ci queries needed_assets to figure out which assets are still needed.
+// 4. Once an asset is not needed, syz-ci removes the corresponding file.
+type NewAsset struct {
+ DownloadURL string
+ Type AssetType
+}
+
+type AddBuildAssetsReq struct {
+ BuildID string
+ Assets []NewAsset
+}
+
+func (dash *Dashboard) AddBuildAssets(req *AddBuildAssetsReq) error {
+ return dash.Query("add_build_assets", req, nil)
+}
+
+type NeededAssetsResp struct {
+ DownloadURLs []string
+}
+
+func (dash *Dashboard) NeededAssetsList() (*NeededAssetsResp, error) {
+ resp := new(NeededAssetsResp)
+ err := dash.Query("needed_assets", nil, resp)
+ return resp, err
+}
+
type BugListResp struct {
List []string
}