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 return a.snapshotFiles
} }
func (a *AddCommand) ProvidesFilesToSnapshot() bool {
return true
}
// String returns some information about the command for the image config // String returns some information about the command for the image config
func (a *AddCommand) String() string { func (a *AddCommand) String() string {
return a.cmd.String() return a.cmd.String()

View File

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

View File

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

View File

@ -75,7 +75,3 @@ func (w *WorkdirCommand) String() string {
func (w *WorkdirCommand) MetadataOnly() bool { func (w *WorkdirCommand) MetadataOnly() bool {
return false return false
} }
func (w *WorkdirCommand) ProvidesFilesToSnapshot() bool {
return true
}

View File

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