Open
Description
Issue Description
When using buildah with (recently added) option to ADD
a git repository, the layer cache is not reused (like in BuildKit) even when referencing a specific commit.
Steps to reproduce the issue
Steps to reproduce the issue:
Dockerfile:
FROM debian:stable-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates git
RUN git clone https://github.com/containers/buildah.git --depth 1 buildah-git
ADD https://github.com/containers/buildah.git#cd2bb6169f2f70794b9276b1ebdb13e891d989b1 buildah-add
Run:
$ buildah bud --layers . | tee bud.1.log
STEP 1/4: FROM debian:stable-slim
STEP 2/4: RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates git
Get:1 http://deb.debian.org/debian stable InRelease [151 kB]
Get:2 http://deb.debian.org/debian stable-updates InRelease [55.4 kB]
Get:3 http://deb.debian.org/debian-security stable-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian stable/main amd64 Packages [8792 kB]
Get:5 http://deb.debian.org/debian stable-updates/main amd64 Packages [512 B]
Get:6 http://deb.debian.org/debian-security stable-security/main amd64 Packages [258 kB]
Fetched 9305 kB in 1s (9057 kB/s)
Reading package lists...
...
done.
--> e24110a734fb
STEP 3/4: RUN git clone https://github.com/containers/buildah.git --depth 1 buildah-git
Cloning into 'buildah-git'...
Updating files: 100% (5800/5800), done.
--> 4464f0894065
STEP 4/4: ADD https://github.com/containers/buildah.git#cd2bb6169f2f70794b9276b1ebdb13e891d989b1 buildah-add
COMMIT
--> 5afb2678c777
5afb2678c77705fc443d9c9e3f55d41dd3c34f848cfc28458228f5c45718a01c
$ buildah bud --layers --no-cache . | tee bud.2.log
STEP 1/4: FROM debian:stable-slim
STEP 2/4: RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates git
--> Using cache e24110a734fb7b9382378138d077bf4ae16f7d8cdb578622b237f34b4769a573
--> e24110a734fb
STEP 3/4: RUN git clone https://github.com/containers/buildah.git --depth 1 buildah-git
--> Using cache 4464f08940659c8483e1cd0d06d2664fe685bb21efed64fc18ed76db223be8e0
--> 4464f0894065
STEP 4/4: ADD https://github.com/containers/buildah.git#cd2bb6169f2f70794b9276b1ebdb13e891d989b1 buildah-add
COMMIT
--> cd5f19a5f013
cd5f19a5f01339627cbf73fcbf91bda6cec165dd2cca8d2c17757488a4117e15
Describe the results you received
As shown above, the ADD
layer produces a different checksum each time it's run.
Describe the results you expected
I would expect the layer to be cached and reused.
buildah version output
Version: 1.40.0
Go Version: go1.24.2
Image Spec: 1.1.1
Runtime Spec: 1.2.1
CNI Spec: 1.1.0
libcni Version:
image Version: 5.35.0
Git Commit:
Built: Tue Apr 22 12:20:12 2025
OS/Arch: linux/amd64
BuildPlatform: linux/amd64
buildah info output
Version: 1.40.0
Go Version: go1.24.2
Image Spec: 1.1.1
Runtime Spec: 1.2.1
CNI Spec: 1.1.0
libcni Version:
image Version: 5.35.0
Git Commit:
Built: Tue Apr 22 12:20:12 2025
OS/Arch: linux/amd64
BuildPlatform: linux/amd64
[root@ca1d8a6e3555 work]# buildah info
{
"host": {
"CgroupVersion": "v2",
"Distribution": {
"distribution": "fedora",
"version": "42"
},
"MemFree": 2136408064,
"MemTotal": 67322884096,
"OCIRuntime": "crun",
"SwapFree": 0,
"SwapTotal": 0,
"arch": "amd64",
"cpus": 44,
"hostname": "ca1d8a6e3555",
"kernel": "6.14.4-arch1-2",
"os": "linux",
"rootless": false,
"uptime": "22h 25m 24.17s (Approximately 0.92 days)",
"variant": ""
},
"store": {
"ContainerStore": {
"number": 2
},
"GraphDriverName": "overlay",
"GraphOptions": [
"overlay.imagestore=/var/lib/shared",
"overlay.imagestore=/usr/lib/containers/storage",
"overlay.mount_program=/usr/bin/fuse-overlayfs",
"overlay.mountopt=nodev,fsync=0"
],
"GraphRoot": "/var/lib/containers/storage",
"GraphStatus": {
"Backing Filesystem": "btrfs",
"Native Overlay Diff": "false",
"Supports d_type": "true",
"Supports shifting": "true",
"Supports volatile": "true",
"Using metacopy": "false"
},
"ImageStore": {
"number": 6
},
"RunRoot": "/run/containers/storage"
}
}
Provide your storage.conf
Using official quay.io/buildah/testing (e3627d21b5cb)
Upstream Latest Release
Yes
Additional environment details
Using official quay.io/buildah/testing (e3627d21b5cb)
Additional information
No response