diff --git a/.github/workflows/scripts/kinds/verify-kinds.go b/.github/workflows/scripts/kinds/verify-kinds.go index 0d92fff28ae..72fc3b30476 100644 --- a/.github/workflows/scripts/kinds/verify-kinds.go +++ b/.github/workflows/scripts/kinds/verify-kinds.go @@ -206,7 +206,7 @@ func loadComposableKind(name string, kind string) (kindsys.Kind, error) { fs := fstest.MapFS{ fmt.Sprintf("%s.cue", name): &fstest.MapFile{ - Data: []byte("package grafanaplugin\n" + kind), + Data: []byte(kind), }, } @@ -290,7 +290,7 @@ func (j *ckrJenny) Generate(k kindsys.Composable) (*codejen.File, error) { return nil, err } - newKindBytes = []byte(fmt.Sprintf("package kind\n\n%s", newKindBytes)) + newKindBytes = []byte(fmt.Sprintf("package grafanaplugin\n\n%s", newKindBytes)) return codejen.NewFile(filepath.Join(j.path, "next", "composable", name+".cue"), newKindBytes, j), nil } @@ -399,10 +399,17 @@ func (registry *kindRegistry) getPublishedKind(name string, category string, lat return "", nil } - kindPath := filepath.Join( - registry.zipDir, - fmt.Sprintf("grafana/%s/%s/%s.cue", latestRegistryDir, category, name), - ) + var cueFilePath string + switch category { + case "core": + cueFilePath = fmt.Sprintf("%s/%s.cue", name, name) + case "composable": + cueFilePath = fmt.Sprintf("%s.cue", name) + default: + return "", fmt.Errorf("kind can only be core or composable") + } + + kindPath := filepath.Join(latestRegistryDir, category, cueFilePath) file, err := registry.zipFile.Open(kindPath) if err != nil { return "", fmt.Errorf("failed to open file: %w", err) diff --git a/pkg/plugins/plugindef/plugindef.cue b/pkg/plugins/plugindef/plugindef.cue index b2ec0f409a1..aa0514fc914 100644 --- a/pkg/plugins/plugindef/plugindef.cue +++ b/pkg/plugins/plugindef/plugindef.cue @@ -125,7 +125,7 @@ schemas: [{ // Required Grafana version for this plugin. Validated using // https://github.com/npm/node-semver. - grafanaDependency: =~"^(<=|>=|<|>|=|~|\\^)?([0-9]+)(\\.[0-9x\\*]+)(\\.[0-9x\\*]+)?(\\s(<=|>=|<|=>)?([0-9]+)(\\.[0-9x]+)(\\.[0-9x]+))?$" + grafanaDependency?: =~"^(<=|>=|<|>|=|~|\\^)?([0-9]+)(\\.[0-9x\\*]+)(\\.[0-9x\\*]+)?(\\s(<=|>=|<|=>)?([0-9]+)(\\.[0-9x]+)(\\.[0-9x]+))?$" // An array of required plugins on which this plugin depends plugins?: [...#Dependency] diff --git a/pkg/plugins/plugindef/plugindef_types_gen.go b/pkg/plugins/plugindef/plugindef_types_gen.go index c9ad1b92786..1f419341259 100644 --- a/pkg/plugins/plugindef/plugindef_types_gen.go +++ b/pkg/plugins/plugindef/plugindef_types_gen.go @@ -98,7 +98,7 @@ type BuildInfo struct { type Dependencies struct { // Required Grafana version for this plugin. Validated using // https://github.com/npm/node-semver. - GrafanaDependency string `json:"grafanaDependency"` + GrafanaDependency *string `json:"grafanaDependency,omitempty"` // (Deprecated) Required Grafana version for this plugin, e.g. // `6.x.x 7.x.x` to denote plugin requires Grafana v6.x.x or