Skip to content

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

@chases2

Description

@chases2

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.

rpc ListDashboard(ListDashboardRequest) returns (ListDashboardResponse) {}

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 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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions