diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2025-06-30 17:15:48 +0300 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-10-06 08:29:13 +0000 |
| commit | fd070483688b68ab7c0fef4bfbf2cdc2defd5f63 (patch) | |
| tree | a162020d38528c1d6f19f3aeec1a71eefcc6673a /dashboard | |
| parent | dfce4a517db03fbd9bd29560bfb17b7ecfeccda2 (diff) | |
kcidb: convert from Google PubSub to plain REST interface
KCIDB removing Google PubSub and start to accept REST submissions.
This will require new configuration options, such as REST URL and
token.
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
Diffstat (limited to 'dashboard')
| -rw-r--r-- | dashboard/app/config.go | 25 | ||||
| -rw-r--r-- | dashboard/app/kcidb.go | 2 |
2 files changed, 13 insertions, 14 deletions
diff --git a/dashboard/app/config.go b/dashboard/app/config.go index 8c9d9fb6e..7f9885fd9 100644 --- a/dashboard/app/config.go +++ b/dashboard/app/config.go @@ -4,11 +4,11 @@ package main import ( - "bytes" "context" "encoding/json" "fmt" "net/mail" + "net/url" "regexp" "strings" "time" @@ -366,12 +366,10 @@ type CCConfig struct { type KcidbConfig struct { // Origin is how this system identified in Kcidb, e.g. "syzbot_foobar". Origin string - // Project is Kcidb GCE project name, e.g. "kernelci-production". - Project string - // Topic is pubsub topic to publish messages to, e.g. "playground_kernelci_new". - Topic string - // Credentials is Google application credentials file contents to use for authorization. - Credentials []byte + // RestURI is the REST API endpoint to which the Kcidb client will send data. + RestURI string + // Token is the authorization token to use for the Kcidb client. + Token string } // ThrottleConfig determines how many requests a single client can make in a period of time. @@ -813,14 +811,15 @@ func checkKcidb(ns string, kcidb *KcidbConfig) { if !regexp.MustCompile("^[a-z0-9_]+$").MatchString(kcidb.Origin) { panic(fmt.Sprintf("%v: bad Kcidb origin %q", ns, kcidb.Origin)) } - if kcidb.Project == "" { - panic(fmt.Sprintf("%v: empty Kcidb project", ns)) + if kcidb.RestURI == "" { + panic(fmt.Sprintf("%v: empty Kcidb RestURI", ns)) } - if kcidb.Topic == "" { - panic(fmt.Sprintf("%v: empty Kcidb topic", ns)) + // Validate RestURI must be a valid URL. + if _, err := url.ParseRequestURI(kcidb.RestURI); err != nil { + panic(fmt.Sprintf("%v: invalid Kcidb RestURI %q: %v", ns, kcidb.RestURI, err)) } - if !bytes.Contains(kcidb.Credentials, []byte("private_key")) { - panic(fmt.Sprintf("%v: empty Kcidb credentials", ns)) + if kcidb.Token == "" || len(kcidb.Token) < 8 { + panic(fmt.Sprintf("%v: bad Kcidb token %q", ns, kcidb.Token)) } } diff --git a/dashboard/app/kcidb.go b/dashboard/app/kcidb.go index f2cfeaacb..25ec23424 100644 --- a/dashboard/app/kcidb.go +++ b/dashboard/app/kcidb.go @@ -32,7 +32,7 @@ func handleKcidbPoll(w http.ResponseWriter, r *http.Request) { } func handleKcidbNamespce(c context.Context, ns string, cfg *KcidbConfig) error { - client, err := kcidb.NewClient(c, cfg.Origin, cfg.Project, cfg.Topic, cfg.Credentials) + client, err := kcidb.NewClient(c, cfg.Origin, cfg.RestURI, cfg.Token) if err != nil { return err } |
