mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Try to use latest version
This commit is contained in:
parent
d0c1556b08
commit
682385c0e4
@ -1,6 +1,8 @@
|
||||
package codegen
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"cuelang.org/go/cue"
|
||||
@ -26,6 +28,24 @@ func (j *schemaregjenny) JennyName() string {
|
||||
}
|
||||
|
||||
func (j *schemaregjenny) Generate(kind kindsys.Kind) (*codejen.File, error) {
|
||||
// Get
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error retrieving working directory", err)
|
||||
}
|
||||
|
||||
groot := filepath.Join(wd, "..", "..")
|
||||
bytes, err := os.ReadFile(filepath.Join(groot, "latest.json"))
|
||||
|
||||
type latestJSON struct {
|
||||
Stable string `json:"stable"`
|
||||
}
|
||||
var latest latestJSON
|
||||
err = json.Unmarshal(bytes, &latest)
|
||||
if err != nil {
|
||||
return nil fmt.Errorf("error unmarshalling latest.json", err)
|
||||
}
|
||||
|
||||
node := kind.Lineage().Underlying().Syntax(
|
||||
cue.All(),
|
||||
cue.Definitions(true),
|
||||
@ -38,7 +58,7 @@ func (j *schemaregjenny) Generate(kind kindsys.Kind) (*codejen.File, error) {
|
||||
}
|
||||
|
||||
name := kind.Props().Common().MachineName
|
||||
path := filepath.Join(j.path, "next", name+"_gen.cue")
|
||||
path := filepath.Join(j.path, latest.Stable, name+"_gen.cue")
|
||||
|
||||
return codejen.NewFile(path, bytes, j), nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user