From 2c79982bd3fb22e51db1d3261257e005b7415657 Mon Sep 17 00:00:00 2001 From: Jeff McCune Date: Fri, 20 Dec 2024 07:11:07 -0800 Subject: [PATCH] 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. --- internal/builder/instance.go | 3 ++- version/embedded/minor | 2 +- version/embedded/patch | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/builder/instance.go b/internal/builder/instance.go index e44c317a..6ec045c4 100644 --- a/internal/builder/instance.go +++ b/internal/builder/instance.go @@ -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" @@ -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) diff --git a/version/embedded/minor b/version/embedded/minor index 398050c6..257e5632 100644 --- a/version/embedded/minor +++ b/version/embedded/minor @@ -1 +1 @@ -101 +102 diff --git a/version/embedded/patch b/version/embedded/patch index 45a4fb75..573541ac 100644 --- a/version/embedded/patch +++ b/version/embedded/patch @@ -1 +1 @@ -8 +0