diff --git a/go.mod b/go.mod index 50f851e..b943551 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ retract ( ) require ( - github.com/buildkite/interpolate v0.1.4 + github.com/buildkite/interpolate v0.1.5 github.com/google/go-cmp v0.6.0 github.com/gowebpki/jcs v1.0.1 github.com/lestrrat-go/jwx/v2 v2.1.3 diff --git a/go.sum b/go.sum index f4ebb36..1165748 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/buildkite/interpolate v0.1.4 h1:qacB5WR+7+Ol1xiJ4xZajHh/CGDdhcMesXR+V3thZPA= -github.com/buildkite/interpolate v0.1.4/go.mod h1:dHnrwHew5O8VNOAgMDpwRlFnhL5VSN6M1bHVmRZ9Ccc= +github.com/buildkite/interpolate v0.1.5 h1:v2Ji3voik69UZlbfoqzx+qfcsOKLA61nHdU79VV+tPU= +github.com/buildkite/interpolate v0.1.5/go.mod h1:dHnrwHew5O8VNOAgMDpwRlFnhL5VSN6M1bHVmRZ9Ccc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= diff --git a/interpolate_test.go b/interpolate_test.go index 2ff631b..0914791 100644 --- a/interpolate_test.go +++ b/interpolate_test.go @@ -206,6 +206,31 @@ func TestInterpolator(t *testing.T) { }, }, }, + { + name: "empty_variable_reference", + caseSensitive: true, + runtimeEnv: map[string]string{"FOO_BAR": "runtime_baz", "SECOND": "BAR"}, + input: &Pipeline{ + Env: ordered.MapFromItems( + ordered.TupleSS{Key: "BUILDKITE_MESSAGE", Value: "This $ is literal and should be ignored"}, + ), + Steps: Steps{ + &CommandStep{ + Command: "echo $BUILDKITE_MESSAGE", + }, + }, + }, + expected: &Pipeline{ + Env: ordered.MapFromItems( + ordered.TupleSS{Key: "BUILDKITE_MESSAGE", Value: "This $ is literal and should be ignored"}, + ), + Steps: Steps{ + &CommandStep{ + Command: "echo This $ is literal and should be ignored", + }, + }, + }, + }, { name: "runtime_env_precedence_order", runtimeEnv: map[string]string{"FOO": "runtime_foo"},