-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bake: skip empty attributes #2832
Conversation
Signed-off-by: CrazyMax <[email protected]>
Signed-off-by: CrazyMax <[email protected]>
bake/bake_test.go
Outdated
// 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() | ||
|
||
_, _, err := ReadTargets(ctx, []File{fp}, []string{"app"}, nil, nil) | ||
require.NoError(t, err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test works in current state but when looking at the app
target it contains an empty ExportEntry
, while previously there were none. So I guess we need to make some changes in the HCL parser as well. I will update this test to make sure of it.
252e9e1
to
6b365ea
Compare
|
||
m, _, err := ReadTargets(ctx, []File{fp}, []string{"app"}, nil, nil) | ||
require.Equal(t, 1, len(m)) | ||
require.Len(t, m["app"].Outputs, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It fails as expected: https://github.com/docker/buildx/actions/runs/12120057362/job/33787924177?pr=2832#step:6:1326
=== FAIL: bake TestEmptyAttribute (0.00s)
bake_test.go:2038:
Error Trace: /home/runner/work/buildx/buildx/bake/bake_test.go:2038
Error: "[]" should have 0 item(s), but has 1
Test: TestEmptyAttribute
relates to #428
fixes #2822
closes #2826