flip the flag

This commit is contained in:
Tejal Desai 2020-05-01 23:41:06 -07:00
parent 7d32139a13
commit 75864d5c85
5 changed files with 5 additions and 19 deletions

View File

@ -116,10 +116,6 @@ func (a *AddCommand) FilesToSnapshot() []string {
return a.snapshotFiles
}
func (a *AddCommand) ProvidesFilesToSnapshot() bool {
return true
}
// String returns some information about the command for the image config
func (a *AddCommand) String() string {
return a.cmd.String()

View File

@ -33,7 +33,7 @@ func (b *BaseCommand) FilesToSnapshot() []string {
}
func (b *BaseCommand) ProvidesFilesToSnapshot() bool {
return false
return true
}
func (b *BaseCommand) FilesUsedFromContext(_ *v1.Config, _ *dockerfile.BuildArgs) ([]string, error) {

View File

@ -138,10 +138,6 @@ func (c *CopyCommand) MetadataOnly() bool {
return false
}
func (c *CopyCommand) ProvidesFilesToSnapshot() bool {
return true
}
func (c *CopyCommand) RequiresUnpackedFS() bool {
return true
}
@ -218,10 +214,6 @@ func (cr *CachingCopyCommand) MetadataOnly() bool {
return false
}
func (cr *CachingCopyCommand) ProvidesFilesToSnapshot() bool {
return true
}
func (cr *CachingCopyCommand) String() string {
if cr.cmd == nil {
return "nil command"

View File

@ -74,8 +74,4 @@ func (w *WorkdirCommand) String() string {
func (w *WorkdirCommand) MetadataOnly() bool {
return false
}
func (w *WorkdirCommand) ProvidesFilesToSnapshot() bool {
return true
}
}

View File

@ -318,6 +318,7 @@ func (s *stageBuilder) build() error {
}
initSnapshotTaken := false
layer := 0
cacheGroup := errgroup.Group{}
for index, command := range s.cmds {
@ -370,7 +371,8 @@ func (s *stageBuilder) build() error {
if !s.shouldTakeSnapshot(index, files, command.ProvidesFilesToSnapshot()) {
continue
}
layer++
logrus.Infof(fmt.Sprintf("%d", layer))
if isCacheCommand {
v := command.(commands.Cached)
layer := v.Layer()