-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
refactor: remove yq dependency #386
Conversation
bazel-lib 2.0 is out: https://github.com/aspect-build/bazel-lib/releases/tag/v2.0.0 |
Hey all, Is this PR ready to be merged ?. Thanks. |
This is now ready to land in 2.x |
local platform=$("${JQ}" -c '{"os": .os, "architecture": .architecture, "variant": .variant, "os.version": .["os.version"], "os.features": .["os.features"]} | with_entries(select( .value != null ))' "${image_path}/blobs/${config_blob_path}") | ||
"${JQ}" --argjson platform "${platform}" \ | ||
--argjson manifest "${manifest}" \ | ||
'.manifests |= [$manifest + {"platform": $platform}]'\ |
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.
Per discussion in the "docker" channel of the "Bazel" Slack workspace, this attempt to append to the "manifests" field doesn't work as intended.
Instead, I think we need the following, as suggested in jq's documentation on Complex assignments:
'.manifests |= . + [$manifest + {"platform": $platform}]'\
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.
Please see #633 for a proposed correction.
In the recent bazel-contrib#386, when we replaced use of the "yq" tool with the "jq" tool, we translated the "oci_image_index" rule's accumulation of image manifests incorrectly, such that we lose all but the last index that we add to the index. In "jq", the "update-assignment" operator (|=) does not append to an array supplied as its left-hand context value automatically. Instead, one must use a "complex assignment", mentioning the context value explicitly together with the addition operator.
In the recent bazel-contrib#386, when we replaced use of the "yq" tool with the "jq" tool, we translated the "oci_image_index" rule's accumulation of image manifests incorrectly, such that we lose all but the last index that we add to the index. In "jq", the "update-assignment" operator (|=) does not append to an array supplied as its left-hand context value automatically. Instead, one must use a "complex assignment", mentioning the context value explicitly together with the addition operator.
In the recent bazel-contrib#386, when we replaced use of the "yq" tool with the "jq" tool, we translated the "oci_image_index" rule's accumulation of image manifests incorrectly, such that we lose all but the last index that we add to the index. In "jq", the "update-assignment" operator (|=) does not append to an array supplied as its left-hand context value automatically. Instead, one must use a "complex assignment", mentioning the context value explicitly together with the addition operator.
Fixes #384. blocked on bazel-lib 2.0