mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Kinds: Reconcile verify-kinds.go with kind-registry changes (#73689)
* Kinds: Reconcile verify-kinds.go with kind-registry changes
* Remove handwritten value specific for manual test
* Update grafana/kindsys dep
* Revert "Update grafana/kindsys dep"
This reverts commit e437e1879e
.
* Fix generated code
This commit is contained in:
parent
25fd8f2d59
commit
fb0165ab87
19
.github/workflows/scripts/kinds/verify-kinds.go
vendored
19
.github/workflows/scripts/kinds/verify-kinds.go
vendored
@ -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)
|
||||
|
@ -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]
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user