Skip to content
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

Allow cache probing to work when instructions (e.g. RUN) don't change any files #326

Closed
mafredri opened this issue Aug 27, 2024 · 2 comments · Fixed by #355
Closed

Allow cache probing to work when instructions (e.g. RUN) don't change any files #326

mafredri opened this issue Aug 27, 2024 · 2 comments · Fixed by #355
Assignees

Comments

@mafredri
Copy link
Member

Related: #230

In coder/kaniko#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:

  1. Push empty cache layers for instructions with no-change
  2. Allow md5(RUN systemctl enable ssh) to be part of the next instructions cache key
@johnstcn
Copy link
Member

cc @bpmct -- we may want to pull this into #132

@mafredri mafredri changed the title Allow cache probing to work when instructions consist of layers where no files were changed Allow cache probing to work when instructions (e.g. RUN) don't change any files Aug 27, 2024
@bpmct
Copy link
Member

bpmct commented Aug 27, 2024

Agreed, let's do it. We also set Oct 1 as the deadline for v1.0 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants