Merge pull request #18 from mzihlmann/warn-about-cache-misses

RUN commands dont specify which files were added
This commit is contained in:
Martin Zihlmann 2025-05-27 21:56:57 +01:00 committed by GitHub
commit 2d14b6a277
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -437,7 +437,8 @@ func (s *stageBuilder) build() error {
// Raise Warnings for commands that are uncacheable
switch command.(type) {
case *commands.RunCommand:
if len(files) == 0 {
fi, err := os.Stat(tarPath)
if err == nil && fi.Size() <= emptyTarSize {
logrus.Warn("cache-violation: RUN created an empty layer, this will cause a diff when rebuilding from cache for the first time.")
}
case *commands.WorkdirCommand: