This commit is contained in:
Martin Zihlmann 2025-06-06 20:48:49 +02:00 committed by GitHub
commit 9e341c3631
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 4 deletions

View File

@ -398,10 +398,14 @@ func (s *stageBuilder) build() error {
continue continue
} }
if isCacheCommand { if isCacheCommand {
v := command.(commands.Cached) if files != nil && len(files) == 0 {
layer := v.Layer() logrus.Info("No files were changed, appending empty layer to config. No layer added to image.")
if err := s.saveLayerToImage(layer, command.String()); err != nil { } else {
return errors.Wrap(err, "failed to save layer") v := command.(commands.Cached)
layer := v.Layer()
if err := s.saveLayerToImage(layer, command.String()); err != nil {
return errors.Wrap(err, "failed to save layer")
}
} }
} else { } else {
tarPath, err := s.takeSnapshot(files, command.ShouldDetectDeletedFiles()) tarPath, err := s.takeSnapshot(files, command.ShouldDetectDeletedFiles())