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

[Bug] Support stamping on yq rule not working when stamp coming from running a "non-mocked" workspace_status script #463

Closed
opicaud opened this issue Jun 22, 2023 · 1 comment · Fixed by #464
Labels
untriaged Requires traige

Comments

@opicaud
Copy link

opicaud commented Jun 22, 2023

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

Originally posted by @opicaud in #223 (comment)

@github-actions github-actions bot added the untriaged Requires traige label Jun 22, 2023
@opicaud opicaud changed the title Support stamping on yq rule not working when stamp coming from running workspace_status script [Bug] Support stamping on yq rule not working when stamp coming from running workspace_status script Jun 22, 2023
@opicaud opicaud changed the title [Bug] Support stamping on yq rule not working when stamp coming from running workspace_status script [Bug] Support stamping on yq rule not working when stamp coming from running a "non-mocked" workspace_status script Jun 22, 2023
@malt3
Copy link
Contributor

malt3 commented Jun 22, 2023

Hey. Thanks for raising this issue. I can reproduce your bug.

It turns out when I first implemented this, I used a newer version of yq on my host when finding a working yq expression to read the stamping info from the volatile and stable info files.

This seems to be broken with any yq version older than 4.30.3. Since the yq version in this ruleset is held back to 4.25.2, it is broken by default.

The bug I'm hitting is this: mikefarah/yq#1430 and it was solved here mikefarah/yq@e02bb71.
Basically, split("\n") is broken in older versions.

To reproduce, you can use this expression:

yq 'load_str(filename) | split("\n")' bazel-out/stable-status.txt

Output on yq >= 4.30.3:

yq 'load_str(filename) | split("\n")' bazel-out/stable-status.txt  
- BUILD_EMBED_LABEL v1.2.3
- BUILD_HOST x1mp
- BUILD_USER malte
- STABLE_BUILD_FROM_WORKSPACE_STATUS_SCRIPT from_workspace_status_script
- STABLE_BUILD_SCM_LOCAL_CHANGES dirty
- STABLE_BUILD_SCM_SHA d53869af5c7c199bc7288b9884a884828f6ea5af
- STABLE_BUILD_SCM_TAG v1.32.1-15-gd53869a
- ""

Output on older versions:

yq 'load_str(filename) | split("\n")' bazel-out/stable-status.txt  
- |
  BUILD_EMBED_LABEL v1.2.3
  BUILD_HOST x1mp
  BUILD_USER malte
  STABLE_BUILD_FROM_WORKSPACE_STATUS_SCRIPT from_workspace_status_script
  STABLE_BUILD_SCM_LOCAL_CHANGES dirty
  STABLE_BUILD_SCM_SHA d53869af5c7c199bc7288b9884a884828f6ea5af
  STABLE_BUILD_SCM_TAG v1.32.1-15-gd53869a

I'm currently trying to find an expression that works also on older yq versions.

alexeagle pushed a commit that referenced this issue Jun 23, 2023
Fixes d79f4d4
Fixes #463

This is required since versions of yq older than 4.30.3 do not parse "\n" correctly.
See mikefarah/yq#1430 and e02bb7194897edb916a6787fb8f8e5a7f432dd94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged Requires traige
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants