Upgrading from: v0.25.x, v0.26.0
This version contains a change to how kinds are written in CUE for use with the CLI commands (generate
,project
).
Instead of every top-level selector in the loaded CUE environment being treated as a kind,
the CUE environment should have a singular manifest which contains app information and a list of kinds to use for the app.
The grafana-app-sdk will look for the selector manifest
by default to load this manifest, but this can be changed with the --selectors
flag.
The CUE structure of a kind has also been changed slightly: fields that were previously in apiResource
are now in the root structure of the kind,
and group
has been removed, as it gets inherited from the manifest (all kinds in a manifest must be in the same group).
A simple version of a manifest looks like:
manifest: {
appName: "myapp" // app name is used to determine group
kinds: [mykind1, mykind2] // list of kind selectors
}
If you currently are using a custom group name via apiResource.groupOverride
, you can still use groupOverride
in the manifest instead,
and the value will be propagated to the kind.
You can also look at the diff for the test kind CUE between v0.26.0 and v0.27.0 as a reference for these changes.
Tip
You can create a new project with grafana-app-sdk init <modname>
and add a kind with grafana-app-sdk project kind add <kindname>
to see the new structure of your CUE, with inline comments
To migrate your CUE to use a manifest, use the following steps:
- For each kind, move any field you have in
apiResource
into the root of the kind. For example,mykind.apiResource.scope
becomesmykind.scope
- Remove the
group
field andgroupOverride
(if applicable) from each kind - Create a file in your kinds directory called
manifest.cue
which looks like this:package kinds manifest: { appName: "<what-the-group-in-your-kinds-was-previously>" kinds: [<selectors for each of our kinds>] }