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

refactor: remove yq dependency #386

Merged
merged 8 commits into from
Apr 25, 2024
Merged

refactor: remove yq dependency #386

merged 8 commits into from
Apr 25, 2024

Conversation

thesayyn
Copy link
Collaborator

@thesayyn thesayyn commented Oct 4, 2023

Fixes #384. blocked on bazel-lib 2.0

oci/private/image.bzl Outdated Show resolved Hide resolved
@rcorre
Copy link

rcorre commented Nov 15, 2023

@thesayyn thesayyn added this to the bazel-lib 2.0 milestone Dec 12, 2023
@oh-tarnished
Copy link

Hey all,

Is this PR ready to be merged ?. Thanks.

@thesayyn thesayyn changed the base branch from main to 2.x April 24, 2024 22:11
@thesayyn thesayyn changed the base branch from 2.x to main April 24, 2024 22:41
@thesayyn thesayyn changed the base branch from main to 2.x April 24, 2024 22:41
@thesayyn thesayyn requested review from alexeagle and removed request for alexeagle April 24, 2024 22:47
@thesayyn
Copy link
Collaborator Author

This is now ready to land in 2.x

@alexeagle alexeagle merged commit 5088c9f into 2.x Apr 25, 2024
20 checks passed
@alexeagle alexeagle deleted the remove_yq branch April 25, 2024 17:41
thesayyn added a commit that referenced this pull request May 30, 2024
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}]'\
Copy link
Contributor

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}]'\

Copy link
Contributor

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.

seh added a commit to seh/rules_oci that referenced this pull request Jun 20, 2024
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.
seh added a commit to seh/rules_oci that referenced this pull request Jun 20, 2024
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.
seh added a commit to seh/rules_oci that referenced this pull request Jun 25, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

drop YQ dependency with bazel-lib 2.0
5 participants