GoogleCloudPlatform / GoogleCloudPlatform/testgrid
TestGrid API: Dashboards should contain a reference to the group they belong to
- Dominant language
- Go
- Stars
- 205
- Forks
- 73
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 6
Description
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](https://testgrid.k8s.io/) 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:
- Replacing the "Resource" with a new "DashboardResource" message that you can then add whatever you want to.
- Returning two "Resource"s, one to the Dashboard and another to the Group.
For more info, https://protobuf.dev/ is a good place to start. We use "proto3" everywhere, not proto2. There is a [go-specific](https://protobuf.dev/getting-started/gotutorial/) 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](https://github.com/GoogleCloudPlatform/testgrid/tree/master/pb#changing-a-protocol-buffer-definition):
`bazel run //hack:update-protos`
## Updating the API
The API that actually emits this data is [here](https://github.com/GoogleCloudPlatform/testgrid/tree/master/pkg/api#testgrid-http-api). I leave this one more open-ended, since there are a lot of examples in `config.go` and `config_test.go` to reference.
Contributor guide
Assessment
This issue has not been assessed yet.