Skip to content
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

Add ability to output json lists in metadata build file #2777

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

LaurentGoderre
Copy link
Member

Supports metadata descriptors list in BuildKit moby/buildkit#5454

commands/build.go Outdated Show resolved Hide resolved
out := make(map[string]interface{})
for k, v := range response {
var dt []byte
j, ok := v.(string)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this means that any base64 string is decoded then I don't think that can be done as false positives can happen when regular string happens to be valid base64. Valid JSON array could work though, assuming that previous versions of buildx does not produce an error (previous versions failing to decode is unavoidable I guess).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this comment was addressed. Looks like any value can be base64 encoded now. To avoid false positives, should be limited to JSON arrays and objects. Eg. "MTU0" should not be decoded to "154"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed all of this code. The new code is much smaller and doesn't touch the existing base64 handling

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it does change the valid values from JSON objects to any value afaics

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AAh, check out this new version then that is a bit more prescriptive

@LaurentGoderre
Copy link
Member Author

@tonistiigi thanks! I missed that function!

Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
@tonistiigi tonistiigi merged commit 6caa151 into docker:master Nov 11, 2024
112 checks passed
@LaurentGoderre LaurentGoderre deleted the metadata-list-support branch November 11, 2024 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants