-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
I'am building an image foo/app
with the following aspects:
- The image gets the tag
:build-latest
,:build-latest-master
,build-nr-<buildID>
i build using
CACHE_FROM=foo/app:build-latest-master
TARGET_IMG=foo/app:build-nr-$CI_BUILDNR
docker build --label "ci.buildNumber=$CI_BUILDNR" --label "vcs.branch=$VCS_BRANCH" --label "vcs.commithash=$VCS_COMMITHASH" --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $CACHE_FROM -f Dockerfile -t $TARGET_IMG .
docker tag $TARGET_IMG foo/app:build-latest-master
docker tag $TARGET_IMG foo/app:build-latest
docker push $TARGET_IMG
docker push foo/app:build-latest
docker push foo/app:build-latest-master
Oddly, every time the cache is used, the produced image does not include the right layers, not the one that have been cached - it must be some very old or cut of layer cache.
The second odd thing is, that the cache is used only every second build. This means, that every second build my actual image is not broken but also it is not cached at all, and then my image is outdated (but cache is used).
Could it be that the layer cache is never updated in the registry at all even though i push docker push foo/app:build-latest-master
since somehow the inline cache is only attached to foo/app:build-nr-$CI_BUILDNR
and cannot be "tagged and pushed using a diffrent tag name" ?
Let me know if you need anything else or more specific to understand the issue