-
Notifications
You must be signed in to change notification settings - Fork 760
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
Build uses cache despite ENV being set to differing ARG value #5501
Comments
I'm seeing this, too, in debian bookworm, podman v4.3.1 FROM busybox
ARG NUM
ENV NUM=${NUM}
ENTRYPOINT echo is $NUM N=1; podman build -t nix$N --build-arg NUM=$N .
N=2; podman build -t nix$N --build-arg NUM=$N .
podman run nix1
is 1
podman run nix2
is 1 latter should be |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Description
When an ENV variable is set to a value from ARG and ENV is not subsequently used in a RUN or such, buildah does not invalidate the cache. Instead an older cache entry, with the wrong ENV value is used. This does not happen if the ARG or ENV is used in a subsequent RUN step.
Repro
Dockerfile content
Execute the following a few times:
This will build an image with an increasing value for
counter
and print the value of $something. The use of podman here is just for brevity's sake.Describe the results you received:
The first run is as expected:
but the second run reuses the prior image:
Note that the resulting image ID is the same.
Describe the results you expected:
The second run should not have reused the cached image. I.e. instead of
expected counter value: 2, is 1
, the output should have beenexpected counter value: 2, is 2
.If I add
RUN echo $counter
or
RUN echo $something
to the tail of the Dockerfile, the issue does not occur.
Output of
rpm -q buildah
orapt list buildah
:Reproduces with both of the above.
Output of
buildah version
:Output of
uname -a
:Greetings,
Andres
The text was updated successfully, but these errors were encountered: