github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/tools/syz-kcidb/kcidb.go (about) 1 // Copyright 2020 syzkaller project authors. All rights reserved. 2 // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 package main 5 6 import ( 7 "context" 8 "flag" 9 "os" 10 11 "github.com/google/syzkaller/dashboard/dashapi" 12 "github.com/google/syzkaller/pkg/kcidb" 13 "github.com/google/syzkaller/pkg/tool" 14 ) 15 16 func main() { 17 const ( 18 origin = "syzkcidb" 19 projectID = "kernelci-production" 20 topicName = "playground_kernelci_new" 21 ) 22 var ( 23 flagCred = flag.String("cred", "", "application credentials file for KCIDB") 24 flagDashClient = flag.String("client", "", "dashboard client") 25 flagDashAddr = flag.String("addr", "", "dashboard address") 26 flagDashKey = flag.String("key", "", "dashboard API key") 27 flagBug = flag.String("bug", "", "bug ID to upload to KCIDB") 28 ) 29 flag.Parse() 30 31 dash, err := dashapi.New(*flagDashClient, *flagDashAddr, *flagDashKey) 32 if err != nil { 33 tool.Fail(err) 34 } 35 bug, err := dash.LoadBug(*flagBug) 36 if err != nil { 37 tool.Fail(err) 38 } 39 40 cred, err := os.ReadFile(*flagCred) 41 if err != nil { 42 tool.Fail(err) 43 } 44 kcidb.Validate = true 45 client, err := kcidb.NewClient(context.Background(), origin, projectID, topicName, cred) 46 if err != nil { 47 tool.Fail(err) 48 } 49 defer client.Close() 50 51 if err := client.Publish(bug); err != nil { 52 tool.Fail(err) 53 } 54 }