From 8b029626f3d25f3ceb8a5689ba1201d55ccca0d4 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:41:35 +0100 Subject: [PATCH] bake: additional test for empty variable Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- bake/bake_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bake/bake_test.go b/bake/bake_test.go index 0e76e0ef452..1e4117eeb57 100644 --- a/bake/bake_test.go +++ b/bake/bake_test.go @@ -2008,3 +2008,23 @@ target "app" { require.Contains(t, err.Error(), "FOO must be greater than 5.") }) } + +// https://github.com/docker/buildx/issues/2822 +func TestVariableEmpty(t *testing.T) { + fp := File{ + Name: "docker-bake.hcl", + Data: []byte(` +variable "FOO" { + default = "" +} +target "app" { + output = [FOO] +} +`), + } + + ctx := context.TODO() + + _, _, err := ReadTargets(ctx, []File{fp}, []string{"app"}, nil, nil) + require.NoError(t, err) +}