-
-
Notifications
You must be signed in to change notification settings - Fork 164
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
Stamping with image tags not updating when volatile-status.txt changes #269
Comments
That's the expected behavior of the volatile-status.txt keys. They don't trigger a re-build as they're not considered in the action key. You should use STABLE-prefixed keys if you want the latest value. https://docs.aspect.build/rules/aspect_bazel_lib/docs/stamping/
|
@alexeagle Right, I've read that. But then how do you even use a value like |
More context, we are trying to migrate away from |
When you change any other input to the action, like a source file, you get a new image and it will be stamped with the current timestamp. The cache hit only happens when all other inputs are identical aside from volatile-status.txt |
I believe that we traced this down to the fact that rules_docker's rules_docker passes the status txt files in as arguments to the script that it defines to be run under This means that every time you On the other hand, This is what caused the behavior of rules_docker's |
@alex-torok thanks for that analysis, that's familiar. I think rules_oci is correct, in the sense that a file in bazel-out should be stamped, and the *-status.txt files should be considered bazel-internal and not part of arguments passed to an external program. Do you have time to send a docs PR to |
I'm trying to use stamping to generate dynamic image tags for
oci_push
using thestamp_tags
function from here. One of the variables I want to use isBUILD_TIMESTAMP
which is stored involatile-status.txt
. However after the first attempt to use thestamped
target as shown below, the value forBUILD_TIMESTAMP
no longer updates. As I've played around with this, I think its it because the_stamped_stamp.json
file produced by thejq
function already exists, and therefore the action does not execute and it does not get recreated on subsequent builds, even ifvolatile-status.txt
changes. This is problematic because many things change involatile-status.txt
between builds, even when there are no code changes. For example, we add a-dirty
postfix to our tag (via a stamp variable) if you build the image from a dirty Git tree. Right now if I build the image from a dirty tree, I get the-dirty
postfix. If I commit my code and build from a non-dirty tree, it still says-dirty
.The text was updated successfully, but these errors were encountered: