GoogleCloudPlatform / testgrid

Apache License 2.0
194 stars 68 forks source link

TestGrid API: Dashboards should contain a reference to the group they belong to #1199

Open chases2 opened 1 year ago

chases2 commented 1 year ago

Currently, in the TestGrid API, there is no way to determine what dashboard (or if dashboard X) belongs to a group or not. This makes the index complicated; while the current UI displays groups and next to each other, the new index needs to do a lot of work to show a view this clean.

The List of Dashboards endpoint (http://testgrid-data.k8s.io/api/v1/dashboards) should also include the dashboard group, if there is one.

To do this, you'll need to

  1. Update the API proto with new fields
  2. Enhance the API program to fill these new fields

Adding a New Field

TestGrid's API is defined with this proto. The proto only defines the shape of the API data, so multiple programs can use it.

https://github.com/GoogleCloudPlatform/testgrid/blob/b931ffcb70e23f6a1f9c9495a2df0d2ab91ab142/pb/api/v1/data.proto#L15

You'll need to change the ListDashboard response to include the new data. Unfortunately, the Resource message is used in multiple places, and we don't want to break everything else.

Consider:

For more info, https://protobuf.dev/ is a good place to start. We use "proto3" everywhere, not proto2. There is a go-specific tutorial that is pretty useful.

NOTE: When you've changed the proto, do not worry about running "protoc" correctly. You can regenerate the go code with this command:

bazel run //hack:update-protos

Updating the API

The API that actually emits this data is here. I leave this one more open-ended, since there are a lot of examples in config.go and config_test.go to reference.

ankur12-1610 commented 1 year ago

/assign