bake: skip empty attributes#2832
Closed
crazy-max wants to merge 2 commits intodocker:masterfrom
Closed
Conversation
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
crazy-max
commented
Dec 2, 2024
Comment on lines
+2022
to
+2040
| // 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) | ||
| } |
Member
Author
There was a problem hiding this comment.
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
crazy-max
commented
Dec 2, 2024
|
|
||
| m, _, err := ReadTargets(ctx, []File{fp}, []string{"app"}, nil, nil) | ||
| require.Equal(t, 1, len(m)) | ||
| require.Len(t, m["app"].Outputs, 0) |
Member
Author
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
relates to #428
fixes #2822
closes #2826