Skip to content

Commit

Permalink
cue: enable @embed for loading yaml (#385)
Browse files Browse the repository at this point in the history
mpvl suggests @embed is a more ideal solution than our implementation of
core.Component.Instances for the use case of unifying YAML data updated
by Kargo Stage resources.

See the issue for a link to the discussion.
  • Loading branch information
jeffmccune committed Dec 20, 2024
1 parent e5e4de3 commit 2c79982
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion internal/builder/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"cuelang.org/go/cue"
"cuelang.org/go/cue/cuecontext"
"cuelang.org/go/cue/interpreter/embed"
"cuelang.org/go/cue/load"
"cuelang.org/go/encoding/yaml"
"github.com/holos-run/holos/internal/errors"
Expand Down Expand Up @@ -76,7 +77,7 @@ func LoadInstance(path string, filepaths []string, tags []string) (*Instance, er
ModuleRoot: root,
Tags: tags,
}
ctxt := cuecontext.New()
ctxt := cuecontext.New(cuecontext.Interpreter(embed.New()))

bis := load.Instances([]string{path}, cfg)
values, err := ctxt.BuildInstances(bis)
Expand Down
2 changes: 1 addition & 1 deletion version/embedded/minor
Original file line number Diff line number Diff line change
@@ -1 +1 @@
101
102
2 changes: 1 addition & 1 deletion version/embedded/patch
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8
0

0 comments on commit 2c79982

Please sign in to comment.