RUN commands dont specify which files were added

This commit is contained in:
Martin Zihlmann 2025-05-27 21:55:47 +01:00
parent febeb075a1
commit b058214391
No known key found for this signature in database
GPG Key ID: 0F7784F41354DE99
1 changed files with 2 additions and 1 deletions

View File

@ -421,7 +421,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: