Skip to content

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

@mafredri

Description

@mafredri

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions