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]: expand_template with stamp = 1 ignores changes to volatile-status.txt #856

Closed
daewok opened this issue May 26, 2024 · 1 comment
Closed
Labels
bug Something isn't working untriaged Requires traige

Comments

@daewok
Copy link

daewok commented May 26, 2024

What happened?

My understanding is that the stamping helpers (which expand_template uses) are designed such that if stamp = 1, then the actions will always be re-run when volatile-status.txt changes. However, if I make a simple target and test that, it does not happen.

Version

Development (host) and target OS/architectures: linux/amd64

Output of bazel --version: bazel 7.1.2

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file: 2.7.6

Language(s) and/or frameworks involved: none

How to reproduce

1. Add the following to a BUILD file:


load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template")

expand_template(
    name = "stamped",
    out = "_stamped.tags.txt",
    stamp = 1,
    stamp_substitutions = {"BUILD_VERSION": "{{BUILD_TIMESTAMP}}"},
    template = [
        "BUILD_VERSION",
    ],
)
  1. run bazel build :stamped
  2. run cat bazel-bin/_stamped.tags.txt
  3. wait a couple seconds
  4. run bazel build :stamped
  5. run cat bazel-bin/_stamped.tags.txt
  6. observe that the same thing was printed in steps 3 and 6.


### Any other information?

_No response_
@daewok daewok added the bug Something isn't working label May 26, 2024
@github-actions github-actions bot added the untriaged Requires traige label May 26, 2024
@daewok
Copy link
Author

daewok commented Sep 5, 2024

I think I wildly misinterpreted some of the things I read about expand_template and now believe it is behaving as expected.

@daewok daewok closed this as completed Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged Requires traige
Projects
None yet
Development

No branches or pull requests

1 participant