From 4320fcec940da23a9703a34609cd2479b9fa846f Mon Sep 17 00:00:00 2001 From: David Gamba Date: Thu, 19 Sep 2024 23:30:12 -0600 Subject: [PATCH] bt: Use latest version of cueutils and add print-raw-config flag --- bt/README.adoc | 4 ++++ bt/changelog.adoc | 9 +++++++++ bt/config/config.go | 9 +++++---- bt/config/config_test.go | 7 ++++++- bt/go.mod | 12 ++++++++++-- bt/go.sum | 23 +++++++++++++++++++---- bt/main.go | 17 +++++++++++++++-- bt/stack/config/config.go | 12 ++++++------ bt/stack/config/schema.cue | 2 +- bt/terraform/apply_test.go | 4 +++- bt/terraform/build_test.go | 4 +++- bt/terraform/init_test.go | 4 +++- bt/terraform/plan_test.go | 4 +++- 13 files changed, 87 insertions(+), 24 deletions(-) diff --git a/bt/README.adoc b/bt/README.adoc index b084f07..2ed067c 100644 --- a/bt/README.adoc +++ b/bt/README.adoc @@ -92,6 +92,8 @@ Example: .Config file .bt.cue [source, cue] ---- +package bt + config: { default_terraform_profile: "default" terraform_profile_env_var: "BT_TERRAFORM_PROFILE" @@ -272,6 +274,8 @@ The other is the stack definition, where the workspaces that compose a given sta .bt-stacks.cue [source, cue] ---- +package bt_stacks + // Define the list of components component: "networking": {} component: "kubernetes": { diff --git a/bt/changelog.adoc b/bt/changelog.adoc index a78fb0c..2493c49 100644 --- a/bt/changelog.adoc +++ b/bt/changelog.adoc @@ -1,5 +1,14 @@ = bt +== v0.10.0: Breaking changes + +Updated bt to load config files from the directory by default, this allows to split `bt-stacks` into multiple files. +At least one file named `bt-stacks.cue` is required when using stacks. + +* `.bt.cue` config file now requires `package bt` header. + +* `bt-stacks.cue` config file now requires `package bt_stacks` header. + == v0.9.0: New features * Add color flag. diff --git a/bt/config/config.go b/bt/config/config.go index e185d63..e5e6eba 100644 --- a/bt/config/config.go +++ b/bt/config/config.go @@ -9,6 +9,7 @@ import ( "os" "path/filepath" + "cuelang.org/go/cue" "github.com/DavidGamba/dgtools/buildutils" "github.com/DavidGamba/dgtools/cueutils" ) @@ -111,7 +112,7 @@ func ConfigFromContext(ctx context.Context) *Config { return &Config{} } -func Get(ctx context.Context, filename string) (*Config, string, error) { +func Get(ctx context.Context, value *cue.Value, filename string) (*Config, string, error) { f, err := buildutils.FindFileUpwards(ctx, filename) if err != nil { cfg := &Config{ @@ -133,7 +134,7 @@ func Get(ctx context.Context, filename string) (*Config, string, error) { } defer configFH.Close() - cfg, err := Read(ctx, f, configFH) + cfg, err := Read(ctx, value, f, configFH) if err != nil { return &Config{}, f, fmt.Errorf("failed to read config: %w", err) } @@ -155,7 +156,7 @@ func SetDefaults(ctx context.Context, cfg *Config, filename string) error { return nil } -func Read(ctx context.Context, filename string, configFH io.Reader) (*Config, error) { +func Read(ctx context.Context, value *cue.Value, filename string, configFH io.Reader) (*Config, error) { configs := []cueutils.CueConfigFile{} schemaFilename := "schema.cue" @@ -169,7 +170,7 @@ func Read(ctx context.Context, filename string, configFH io.Reader) (*Config, er configs = append(configs, cueutils.CueConfigFile{Data: configFH, Name: filename}) c := Config{} - err = cueutils.Unmarshal(configs, &c) + err = cueutils.Unmarshal(configs, "", "bt", value, &c) if err != nil { return nil, fmt.Errorf("failed to unmarshal: %w", err) } diff --git a/bt/config/config_test.go b/bt/config/config_test.go index 16cbad0..82499f0 100644 --- a/bt/config/config_test.go +++ b/bt/config/config_test.go @@ -4,11 +4,15 @@ import ( "context" "strings" "testing" + + "github.com/DavidGamba/dgtools/cueutils" ) func TestConfig(t *testing.T) { t.Run("default", func(t *testing.T) { c := ` +package bt + _common: { workspaces: { enabled: true @@ -43,7 +47,8 @@ terraform_profile: { ` ctx := context.Background() r := strings.NewReader(c) - cfg, err := Read(ctx, "config.cue", r) + cfgValue := cueutils.NewValue() + cfg, err := Read(ctx, cfgValue, "config.cue", r) if err != nil { t.Fatalf("failed to read config: %s", err) } diff --git a/bt/go.mod b/bt/go.mod index 5d96a36..9063521 100644 --- a/bt/go.mod +++ b/bt/go.mod @@ -3,8 +3,9 @@ module github.com/DavidGamba/dgtools/bt go 1.23 require ( + cuelang.org/go v0.11.0-alpha.1 github.com/DavidGamba/dgtools/buildutils v0.6.0 - github.com/DavidGamba/dgtools/cueutils v0.0.0-20240917063034-e229ec7937fd + github.com/DavidGamba/dgtools/cueutils v0.2.0 github.com/DavidGamba/dgtools/fsmodtime v0.3.0 github.com/DavidGamba/dgtools/run v0.9.0 github.com/DavidGamba/go-getoptions v0.30.0 @@ -13,18 +14,25 @@ require ( ) require ( - cuelang.org/go v0.10.0 // indirect + cuelabs.dev/go/oci/ociregistry v0.0.0-20240807094312-a32ad29eed79 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/cockroachdb/apd/v3 v3.2.1 // indirect + github.com/emicklei/proto v1.13.2 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/hcl/v2 v2.22.0 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/protocolbuffers/txtpbfmt v0.0.0-20230328191034-3462fbc510c0 // indirect + github.com/rogpeppe/go-internal v1.12.1-0.20240709150035-ccf4b4329d21 // indirect github.com/zclconf/go-cty v1.15.0 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.29.0 // indirect + golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.18.0 // indirect diff --git a/bt/go.sum b/bt/go.sum index 1ff52aa..e3fcd1f 100644 --- a/bt/go.sum +++ b/bt/go.sum @@ -1,11 +1,11 @@ cuelabs.dev/go/oci/ociregistry v0.0.0-20240807094312-a32ad29eed79 h1:EceZITBGET3qHneD5xowSTY/YHbNybvMWGh62K2fG/M= cuelabs.dev/go/oci/ociregistry v0.0.0-20240807094312-a32ad29eed79/go.mod h1:5A4xfTzHTXfeVJBU6RAUf+QrlfTCW+017q/QiW+sMLg= -cuelang.org/go v0.10.0 h1:Y1Pu4wwga5HkXfLFK1sWAYaSWIBdcsr5Cb5AWj2pOuE= -cuelang.org/go v0.10.0/go.mod h1:HzlaqqqInHNiqE6slTP6+UtxT9hN6DAzgJgdbNxXvX8= +cuelang.org/go v0.11.0-alpha.1 h1:pciMZE03E9Uuk+/muceaab2qUSb0k0DYkLcehkDBJI4= +cuelang.org/go v0.11.0-alpha.1/go.mod h1:HzlaqqqInHNiqE6slTP6+UtxT9hN6DAzgJgdbNxXvX8= github.com/DavidGamba/dgtools/buildutils v0.6.0 h1:sbiwJPAdbXF+Gc8L9C+BldaaMRje/qf5BfVYyp0qBMk= github.com/DavidGamba/dgtools/buildutils v0.6.0/go.mod h1:j7DC6tKOOoMy4s6ICP220y2jgRlIGpzLH2wXZo2WF7g= -github.com/DavidGamba/dgtools/cueutils v0.0.0-20240917063034-e229ec7937fd h1:qOSvqv/eRq2z4Rn/dxOqoYWXxMMThSNHz620tM6QZS0= -github.com/DavidGamba/dgtools/cueutils v0.0.0-20240917063034-e229ec7937fd/go.mod h1:6tnalOaPUIq5UWw1PvXboYx9pFnoMcBA+MlWn/NeLI0= +github.com/DavidGamba/dgtools/cueutils v0.2.0 h1:FSMyuMA1GcdARrU+8mRPKLPXG/f7P3btYulcS4ltrmM= +github.com/DavidGamba/dgtools/cueutils v0.2.0/go.mod h1:kedCb8Jioyvt1Qyzc92Iu5IvAVX2BXHW2j3VL0ZvuC4= github.com/DavidGamba/dgtools/fsmodtime v0.3.0 h1:unnbwD+JSadgcqlBI2v524dWcX6dxqD44TSAP5V7sA8= github.com/DavidGamba/dgtools/fsmodtime v0.3.0/go.mod h1:ruwqMvW2pWDbSQlAupP7F0QaojfbuXPyUOUKR4Ev3pQ= github.com/DavidGamba/dgtools/run v0.9.0 h1:Hg0v4ExUMd6Vzf9x9Bqr2yxreZtZpqlcAi8tI86QtIM= @@ -18,6 +18,7 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg= github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emicklei/proto v1.13.2 h1:z/etSFO3uyXeuEsVPzfl56WNgzcvIr42aQazXaQmFZY= @@ -40,6 +41,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -52,10 +55,21 @@ github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQ github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/protocolbuffers/txtpbfmt v0.0.0-20230328191034-3462fbc510c0 h1:sadMIsgmHpEOGbUs6VtHBXRR1OHevnj7hLx9ZcdNGW4= github.com/protocolbuffers/txtpbfmt v0.0.0-20230328191034-3462fbc510c0/go.mod h1:jgxiZysxFPM+iWKwQwPR+y+Jvo54ARd4EisXxKYpB5c= github.com/rogpeppe/go-internal v1.12.1-0.20240709150035-ccf4b4329d21 h1:igWZJluD8KtEtAgRyF4x6lqcxDry1ULztksMJh2mnQE= github.com/rogpeppe/go-internal v1.12.1-0.20240709150035-ccf4b4329d21/go.mod h1:RMRJLmBOqWacUkmJHRMiPKh1S1m3PA7Zh4W80/kWPpg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/zclconf/go-cty v1.15.0 h1:tTCRWxsexYUmtt/wVxgDClUe+uQusuI443uL6e+5sXQ= github.com/zclconf/go-cty v1.15.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo= @@ -78,5 +92,6 @@ golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/bt/main.go b/bt/main.go index cc1d5c9..f18f0c9 100644 --- a/bt/main.go +++ b/bt/main.go @@ -12,6 +12,7 @@ import ( stacksConfig "github.com/DavidGamba/dgtools/bt/stack/config" "github.com/DavidGamba/dgtools/bt/terraform" "github.com/DavidGamba/dgtools/buildutils" + "github.com/DavidGamba/dgtools/cueutils" "github.com/DavidGamba/dgtools/run" "github.com/DavidGamba/go-getoptions" ) @@ -26,8 +27,11 @@ func program(args []string) int { ctx, cancel, done := getoptions.InterruptContext() defer func() { cancel(); <-done }() + os.Setenv("CUE_EXPERIMENT", "embed") + // Read config and store it in context - cfg, _, err := config.Get(ctx, ".bt.cue") + cfgValue := cueutils.NewValue() + cfg, _, err := config.Get(ctx, cfgValue, ".bt.cue") if err != nil { if !errors.Is(err, buildutils.ErrNotFound) { fmt.Fprintf(os.Stderr, "ERROR: %s\n", err) @@ -37,7 +41,8 @@ func program(args []string) int { ctx = config.NewConfigContext(ctx, cfg) // Read config and store it in context - stackCfg, _, err := stacksConfig.Get(ctx, "bt-stacks.cue") + stackValue := cueutils.NewValue() + stackCfg, _, err := stacksConfig.Get(ctx, stackValue, "bt-stacks.cue") if err != nil { if !errors.Is(err, buildutils.ErrNotFound) { fmt.Fprintf(os.Stderr, "ERROR: %s\n", err) @@ -49,6 +54,7 @@ func program(args []string) int { opt := getoptions.New() opt.Self("", "Terraform build system built as a no lock-in wrapper") opt.Bool("quiet", false, opt.GetEnv("QUIET")) + opt.Bool("print-raw-config", false) opt.String("color", "auto", opt.Description("show colored output"), opt.ValidValues("always", "auto", "never")) opt.SetUnknownMode(getoptions.Pass) @@ -68,6 +74,13 @@ func program(args []string) int { config.Logger.SetOutput(io.Discard) stack.Logger.SetOutput(io.Discard) terraform.Logger.SetOutput(io.Discard) + cueutils.Logger.SetOutput(io.Discard) + } + + if opt.Called("print-raw-config") { + fmt.Printf("config value:\n%v\n", cfgValue) + fmt.Printf("stack value:\n%v\n", stackValue) + return 0 } err = opt.Dispatch(ctx, remaining) diff --git a/bt/stack/config/config.go b/bt/stack/config/config.go index db96f84..1fa99b5 100644 --- a/bt/stack/config/config.go +++ b/bt/stack/config/config.go @@ -9,6 +9,7 @@ import ( "os" "path/filepath" + "cuelang.org/go/cue" "github.com/DavidGamba/dgtools/buildutils" "github.com/DavidGamba/dgtools/cueutils" ) @@ -18,7 +19,7 @@ var f embed.FS var Logger = log.New(os.Stderr, "", log.LstdFlags) -func Get(ctx context.Context, filename string) (*Config, string, error) { +func Get(ctx context.Context, value *cue.Value, filename string) (*Config, string, error) { f, err := buildutils.FindFileUpwards(ctx, filename) if err != nil { cfg := &Config{} @@ -31,7 +32,7 @@ func Get(ctx context.Context, filename string) (*Config, string, error) { } defer configFH.Close() - cfg, err := Read(ctx, f, configFH) + cfg, err := Read(ctx, value, f, configFH) if err != nil { return &Config{}, f, fmt.Errorf("failed to read config: %w", err) } @@ -42,9 +43,10 @@ func Get(ctx context.Context, filename string) (*Config, string, error) { return cfg, f, nil } -func Read(ctx context.Context, filename string, configFH io.Reader) (*Config, error) { +func Read(ctx context.Context, value *cue.Value, filename string, configFH io.Reader) (*Config, error) { configs := []cueutils.CueConfigFile{} + dir := filepath.Dir(filename) schemaFilename := "schema.cue" schemaFH, err := f.Open(schemaFilename) if err != nil { @@ -53,10 +55,8 @@ func Read(ctx context.Context, filename string, configFH io.Reader) (*Config, er defer schemaFH.Close() configs = append(configs, cueutils.CueConfigFile{Data: schemaFH, Name: schemaFilename}) - configs = append(configs, cueutils.CueConfigFile{Data: configFH, Name: filename}) - c := Config{} - err = cueutils.Unmarshal(configs, &c) + err = cueutils.Unmarshal(configs, dir, "bt_stacks", value, &c) if err != nil { return nil, fmt.Errorf("failed to unmarshal: %w", err) } diff --git a/bt/stack/config/schema.cue b/bt/stack/config/schema.cue index 6bad586..bb8effb 100644 --- a/bt/stack/config/schema.cue +++ b/bt/stack/config/schema.cue @@ -1,4 +1,4 @@ -package stack +package bt_stacks #ID: string & =~"^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$" diff --git a/bt/terraform/apply_test.go b/bt/terraform/apply_test.go index b8c0f97..7652835 100644 --- a/bt/terraform/apply_test.go +++ b/bt/terraform/apply_test.go @@ -10,6 +10,7 @@ import ( "testing" "github.com/DavidGamba/dgtools/bt/config" + "github.com/DavidGamba/dgtools/cueutils" "github.com/DavidGamba/dgtools/run" "github.com/DavidGamba/go-getoptions" ) @@ -20,7 +21,8 @@ func TestApply(t *testing.T) { t.Run("TestApply without config", func(t *testing.T) { buf := setupLogging() ctx := context.Background() - cfg, _, _ := config.Get(ctx, "x") + value := cueutils.NewValue() + cfg, _, _ := config.Get(ctx, value, "x") ctx = config.NewConfigContext(ctx, cfg) tDir := t.TempDir() ctx = NewDirContext(ctx, tDir) diff --git a/bt/terraform/build_test.go b/bt/terraform/build_test.go index 9cd42be..cdfe26e 100644 --- a/bt/terraform/build_test.go +++ b/bt/terraform/build_test.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/DavidGamba/dgtools/bt/config" + "github.com/DavidGamba/dgtools/cueutils" "github.com/DavidGamba/dgtools/run" "github.com/DavidGamba/go-getoptions" ) @@ -18,7 +19,8 @@ func TestBuild(t *testing.T) { t.Run("TestBuild without config", func(t *testing.T) { buf := setupLogging() ctx := context.Background() - cfg, _, _ := config.Get(ctx, "x") + value := cueutils.NewValue() + cfg, _, _ := config.Get(ctx, value, "x") ctx = config.NewConfigContext(ctx, cfg) tDir := t.TempDir() ctx = NewDirContext(ctx, tDir) diff --git a/bt/terraform/init_test.go b/bt/terraform/init_test.go index 91feb75..83bb14f 100644 --- a/bt/terraform/init_test.go +++ b/bt/terraform/init_test.go @@ -10,6 +10,7 @@ import ( "testing" "github.com/DavidGamba/dgtools/bt/config" + "github.com/DavidGamba/dgtools/cueutils" "github.com/DavidGamba/dgtools/run" "github.com/DavidGamba/go-getoptions" ) @@ -20,7 +21,8 @@ func TestInit(t *testing.T) { t.Run("TestInit without config", func(t *testing.T) { buf := setupLogging() ctx := context.Background() - cfg, _, _ := config.Get(ctx, "x") + value := cueutils.NewValue() + cfg, _, _ := config.Get(ctx, value, "x") ctx = config.NewConfigContext(ctx, cfg) tDir := t.TempDir() ctx = NewDirContext(ctx, tDir) diff --git a/bt/terraform/plan_test.go b/bt/terraform/plan_test.go index 5adaf2f..fd19dfc 100644 --- a/bt/terraform/plan_test.go +++ b/bt/terraform/plan_test.go @@ -11,6 +11,7 @@ import ( "github.com/DavidGamba/dgtools/bt/config" "github.com/DavidGamba/dgtools/buildutils" + "github.com/DavidGamba/dgtools/cueutils" "github.com/DavidGamba/dgtools/run" "github.com/DavidGamba/go-getoptions" ) @@ -21,7 +22,8 @@ func TestPlan(t *testing.T) { t.Run("TestPlan without config", func(t *testing.T) { buf := setupLogging() ctx := context.Background() - cfg, _, _ := config.Get(ctx, "x") + value := cueutils.NewValue() + cfg, _, _ := config.Get(ctx, value, "x") ctx = config.NewConfigContext(ctx, cfg) tDir := t.TempDir() ctx = NewDirContext(ctx, tDir)