bazel-lib icon indicating copy to clipboard operation
bazel-lib copied to clipboard

Support stamping on yq rule

Open alexeagle opened this issue 2 years ago • 1 comments

Useful for things like producing a package.json file that has the version field set from git tags.

alexeagle avatar Aug 22 '22 14:08 alexeagle

Reopening to track the similar thing for yq (though I don't intend to do that now - the rules_js release story doesn't need it)

alexeagle avatar Aug 22 '22 21:08 alexeagle

This would be great to support tag stamping in rules_oci via yq. The jq toolchain is not available on macOS with M1 or linux with arm64.

malt3 avatar Jun 14 '23 14:06 malt3

Hi guys, Big thanks for this feature very vey useful!!

I've tried it and i have an issue that i replicate here with a red test when running bazel test --config=release //lib/tests/yq/... It's unfortunately not working when i stamp a value from stable-status.txt when I use the release config with bazel. For info i am running on Bazel 5.4.0

opicaud avatar Jun 22 '23 19:06 opicaud

Yup, I can repro that, looks like the yq expression

load_str(filename) | split("\n") | .[] 
    | select(length!=0)
    | [capture("(?P<key>[^\s]+)\s+(?P<value>.*)")]

only returns the first entry, which is why our tests for this passed.

alexeagle avatar Jun 23 '23 00:06 alexeagle

Working like a charm :) Thanks guys!

opicaud avatar Jun 23 '23 10:06 opicaud