mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-22 10:09:36 +02:00
add a new method to indicate if the command provides files to snapshot
This commit is contained in:
@@ -116,6 +116,10 @@ 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()
|
||||
|
||||
@@ -32,6 +32,10 @@ func (b *BaseCommand) FilesToSnapshot() []string {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
func (b *BaseCommand) ProvidesFilesToSnapshot() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (b *BaseCommand) FilesUsedFromContext(_ *v1.Config, _ *dockerfile.BuildArgs) ([]string, error) {
|
||||
return []string{}, nil
|
||||
}
|
||||
|
||||
@@ -37,6 +37,10 @@ type DockerCommand interface {
|
||||
// A list of files to snapshot, empty for metadata commands or nil if we don't know
|
||||
FilesToSnapshot() []string
|
||||
|
||||
// ProvidesFileToSnapshot is true for all metadata commands and commands which know
|
||||
// list of files changed. False for Run command.
|
||||
ProvidesFilesToSnapshot() bool
|
||||
|
||||
// Return a cache-aware implementation of this command, if it exists.
|
||||
CacheCommand(v1.Image) DockerCommand
|
||||
|
||||
|
||||
@@ -138,6 +138,10 @@ func (c *CopyCommand) MetadataOnly() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *CopyCommand) ProvidesFilesToSnapshot() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (c *CopyCommand) RequiresUnpackedFS() bool {
|
||||
return true
|
||||
}
|
||||
@@ -210,6 +214,14 @@ func (cr *CachingCopyCommand) FilesToSnapshot() []string {
|
||||
return f
|
||||
}
|
||||
|
||||
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"
|
||||
|
||||
@@ -151,6 +151,10 @@ func (r *RunCommand) FilesToSnapshot() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *RunCommand) ProvidesFilesToSnapshot() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// CacheCommand returns true since this command should be cached
|
||||
func (r *RunCommand) CacheCommand(img v1.Image) DockerCommand {
|
||||
|
||||
@@ -227,3 +231,11 @@ func (cr *CachingRunCommand) String() string {
|
||||
}
|
||||
return cr.cmd.String()
|
||||
}
|
||||
|
||||
func (cr *CachingRunCommand) MetadataOnly() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (cr *CachingRunCommand) RequiresUnpackedFS() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -75,3 +75,7 @@ func (w *WorkdirCommand) String() string {
|
||||
func (w *WorkdirCommand) MetadataOnly() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (w *WorkdirCommand) ProvidesFilesToSnapshot() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user