Open AndrewLipscomb opened 3 months ago
I think this can be easily solved by adding hash of directory to the history, i'd like to propose a solution if @nalind agrees then I can create a patch.
As of now buildah adds history to images for --mount
like.
{
"created": "2024-08-13T15:07:01.335991879Z",
"created_by": "/bin/sh -c --mount=type=bind,source=/host/path/,dst=/test,Z ls /test",
"comment": "FROM docker.io/library/alpine:latest"
},
{
"created": "2024-08-13T15:07:01.335991879Z",
"created_by": "/bin/sh -c --mount=type=bind,source=/home/ar/work/buildah/bin/,dst=/test,Z:<hash-of-the-mounted-directory-or-file> ls /test",
"comment": "FROM docker.io/library/alpine:latest"
},
When the source is in the build context or a previous stage, I guess that'll work. When it's in an image, it's going to be cheaper to use the image's digest.
I agree, in case of image it can be digest. I can take a stab at it.
Issue Description
When building an image using
podman build
and a build mount of type--mount=type=bind
- a change in content within that mount directory does not cause the layer of the build to be invalidated and run again.docker build
on the other hand does do this - I would expect the same behaviour between both programsSteps to reproduce the issue
I have a demo of the problem at https://github.com/AndrewLipscomb/podman-build-cache-issue-demo/tree/main
But in short
For some reproduction instructions in full
Tested with podman 5.0.3 and podman 5.1.2 - both did the same thing Docker version for comparison was
Describe the results you received
The layer is not invalidating on a mount directory content change
Describe the results you expected
The layer should invalidate on a mount directory content change
podman info output