Skip to content

Commit

Permalink
bt: Use latest version of cueutils and add print-raw-config flag
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidGamba committed Sep 20, 2024
1 parent 7a6eb2e commit 4320fce
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 24 deletions.
4 changes: 4 additions & 0 deletions bt/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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": {
Expand Down
9 changes: 9 additions & 0 deletions bt/changelog.adoc
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
9 changes: 5 additions & 4 deletions bt/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"path/filepath"

"cuelang.org/go/cue"
"github.com/DavidGamba/dgtools/buildutils"
"github.com/DavidGamba/dgtools/cueutils"
)
Expand Down Expand Up @@ -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{
Expand All @@ -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)
}
Expand All @@ -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"
Expand All @@ -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)
}
Expand Down
7 changes: 6 additions & 1 deletion bt/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down
12 changes: 10 additions & 2 deletions bt/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
23 changes: 19 additions & 4 deletions bt/go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand All @@ -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=
Expand All @@ -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=
Expand All @@ -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=
Expand All @@ -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=
17 changes: 15 additions & 2 deletions bt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)

Expand All @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions bt/stack/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"path/filepath"

"cuelang.org/go/cue"
"github.com/DavidGamba/dgtools/buildutils"
"github.com/DavidGamba/dgtools/cueutils"
)
Expand All @@ -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{}
Expand All @@ -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)
}
Expand All @@ -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 {
Expand All @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion bt/stack/config/schema.cue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package stack
package bt_stacks

#ID: string & =~"^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$"

Expand Down
4 changes: 3 additions & 1 deletion bt/terraform/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion bt/terraform/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion bt/terraform/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion bt/terraform/plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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)
Expand Down

0 comments on commit 4320fce

Please sign in to comment.