simplify logic for detecting empty layers
This commit is contained in:
parent
49f24a7395
commit
6a7139eeec
|
|
@ -416,9 +416,9 @@ func (s *stageBuilder) build() error {
|
|||
if isCacheCommand {
|
||||
v := command.(commands.Cached)
|
||||
layer := v.Layer()
|
||||
if (files != nil || layer == nil) && len(files) == 0 {
|
||||
// a cache image with a layer with no files indicates that no files were changed, ie. by 'RUN echo hello'
|
||||
// a cache image without a layer indicates that no files were changed too, ie. by 'WORKDIR /'
|
||||
if layer == nil || (files != nil && len(files) == 0) {
|
||||
// a cache image without a layer indicates that no files were changed, ie. by 'WORKDIR /'
|
||||
// a cache image with a layer with no files indicates that no files were changed too, ie. by 'RUN echo hello'
|
||||
logrus.Info("No files were changed, appending empty layer to config. No layer added to image.")
|
||||
} else {
|
||||
if err := s.saveLayerToImage(layer, command.String()); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue