Build development environments from a Dockerfile on Docker, Kubernetes, and OpenShift. Enable developers to modify their development environment quickly.
Apache License 2.0
152
stars
26
forks
source link
Allow cache probing to work when instructions (e.g. `RUN`) don't change any files #326
In https://github.com/coder/kaniko/pull/25 we added support for multi-stage cache probing. While testing the implementation we noticed that sometimes an instruction (e.g. RUN systemctl enable ssh) doesn't change any files. This means the snapshotter won't create a tar archive and the cache layer won't be pushed to the remote registry.
This is problematic when running the cache probe as these instructions will not have a matching cache.
We also can't assume that a missing cache is OK because the hash of the instruction does not affect the next instruction (bug?). Essentially the instruction could be modified (RUN systemctl enable ssh => RUN systemctl disable ssh) and we'd still have a cache hit if we assumed a missing cache was OK.
Potential solutions to fix the problem:
Push empty cache layers for instructions with no-change
Allow md5(RUN systemctl enable ssh) to be part of the next instructions cache key
Related: #230
In https://github.com/coder/kaniko/pull/25 we added support for multi-stage cache probing. While testing the implementation we noticed that sometimes an instruction (e.g.
RUN systemctl enable ssh
) doesn't change any files. This means the snapshotter won't create a tar archive and the cache layer won't be pushed to the remote registry.This is problematic when running the cache probe as these instructions will not have a matching cache.
We also can't assume that a missing cache is OK because the hash of the instruction does not affect the next instruction (bug?). Essentially the instruction could be modified (
RUN systemctl enable ssh
=>RUN systemctl disable ssh
) and we'd still have a cache hit if we assumed a missing cache was OK.Potential solutions to fix the problem:
md5(RUN systemctl enable ssh)
to be part of the next instructions cache key