Skip to content

Commit 2c79982

Browse files
committed
cue: enable @embed for loading yaml (#385)
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.
1 parent e5e4de3 commit 2c79982

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

internal/builder/instance.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
"cuelang.org/go/cue"
1313
"cuelang.org/go/cue/cuecontext"
14+
"cuelang.org/go/cue/interpreter/embed"
1415
"cuelang.org/go/cue/load"
1516
"cuelang.org/go/encoding/yaml"
1617
"github.com/holos-run/holos/internal/errors"
@@ -76,7 +77,7 @@ func LoadInstance(path string, filepaths []string, tags []string) (*Instance, er
7677
ModuleRoot: root,
7778
Tags: tags,
7879
}
79-
ctxt := cuecontext.New()
80+
ctxt := cuecontext.New(cuecontext.Interpreter(embed.New()))
8081

8182
bis := load.Instances([]string{path}, cfg)
8283
values, err := ctxt.BuildInstances(bis)

version/embedded/minor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
101
1+
102

version/embedded/patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8
1+
0

0 commit comments

Comments
 (0)