From 6b365ea3e6735932e9759f9c0a628529804c0cbc Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Thu, 28 Nov 2024 10:29:52 +0100 Subject: [PATCH] bake: test empty attribute 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 b61e2ecff3e..98715a5cd19 100644 --- a/bake/bake_test.go +++ b/bake/bake_test.go @@ -2019,6 +2019,26 @@ target "app" { }) } +// https://github.com/docker/buildx/pull/428 +// https://github.com/docker/buildx/issues/2822 +func TestEmptyAttribute(t *testing.T) { + fp := File{ + Name: "docker-bake.hcl", + Data: []byte(` +target "app" { + output = [""] +} +`), + } + + ctx := context.TODO() + + m, _, err := ReadTargets(ctx, []File{fp}, []string{"app"}, nil, nil) + require.Equal(t, 1, len(m)) + require.Len(t, m["app"].Outputs, 0) + require.NoError(t, err) +} + func stringify[V fmt.Stringer](values []V) []string { s := make([]string, len(values)) for i, v := range values {