buildflags: marshal attestations into json with extra attributes correctly#2937
Merged
crazy-max merged 1 commit intodocker:masterfrom Jan 22, 2025
Merged
Conversation
…ectly `MarshalJSON` would not include the extra attributes because it iterated over the target map rather than the source map. Also fixes JSON unmarshaling for SSH and secrets. The intention was to unmarshal into the struct, but `UnmarshalText` takes priority over the default struct unmarshaling so it didn't work as intended. Tests have been added for all marshaling and unmarshaling methods. Signed-off-by: Jonathan A. Sternberg <[email protected]>
5152eab to
3aed658
Compare
Collaborator
Author
|
Tests have now been added. I found an issue with the JSON unmarshaling for SSH and Secrets so those have also been fixed. Not included in this PR is to support the string format for the JSON format. Currently, the JSON format requires the object syntax. It would be possible to allow a mixing like we do for the HCL syntax. If we want that, we should create an issue to track that work and it can be included in another PR. |
crazy-max
approved these changes
Jan 21, 2025
tonistiigi
approved these changes
Jan 22, 2025
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.
MarshalJSONwould not include the extra attributes because it iterated over the target map rather than the source map.Also fixes JSON unmarshaling for SSH and secrets. The intention was to
unmarshal into the struct, but
UnmarshalTexttakes priority over thedefault struct unmarshaling so it didn't work as intended.
Tests have been added for all marshaling and unmarshaling methods.
Fixes #2936.