Skip to content

Commit 63195d1

Browse files
committed
fix: expand cache probe support to more directives
1 parent dc26a92 commit 63195d1

File tree

16 files changed

+107
-8
lines changed

16 files changed

+107
-8
lines changed

pkg/commands/arg.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ func (r *ArgCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.Bui
4141
return nil
4242
}
4343

44+
func (r *ArgCommand) CachedExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error {
45+
return r.ExecuteCommand(config, buildArgs)
46+
}
47+
4448
func ParseArg(key string, val *string, env []string, ba *dockerfile.BuildArgs) (string, *string, error) {
4549
replacementEnvs := ba.ReplacementEnvs(env)
4650
resolvedKey, err := util.ResolveEnvironmentReplacement(key, replacementEnvs, false)

pkg/commands/cmd.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ func (c *CmdCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.Bui
5454
return nil
5555
}
5656

57+
func (c *CmdCommand) CachedExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error {
58+
return c.ExecuteCommand(config, buildArgs)
59+
}
60+
5761
// String returns some information about the command for the image config history
5862
func (c *CmdCommand) String() string {
5963
return c.cmd.String()

pkg/commands/entrypoint.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ func (e *EntrypointCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerf
5151
return nil
5252
}
5353

54+
func (e *EntrypointCommand) CachedExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error {
55+
return e.ExecuteCommand(config, buildArgs)
56+
}
57+
5458
// String returns some information about the command for the image config history
5559
func (e *EntrypointCommand) String() string {
5660
return e.cmd.String()

pkg/commands/env.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ func (e *EnvCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.Bui
3535
return util.UpdateConfigEnv(newEnvs, config, replacementEnvs)
3636
}
3737

38+
func (e *EnvCommand) CachedExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error {
39+
return e.ExecuteCommand(config, buildArgs)
40+
}
41+
3842
// String returns some information about the command for the image config history
3943
func (e *EnvCommand) String() string {
4044
return e.cmd.String()

pkg/commands/expose.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ func (r *ExposeCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.
6363
return nil
6464
}
6565

66+
func (r *ExposeCommand) CachedExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error {
67+
return r.ExecuteCommand(config, buildArgs)
68+
}
69+
6670
func validProtocol(protocol string) bool {
6771
validProtocols := [2]string{"tcp", "udp"}
6872
for _, p := range validProtocols {

pkg/commands/healthcheck.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ func (h *HealthCheckCommand) ExecuteCommand(config *v1.Config, buildArgs *docker
4646
return nil
4747
}
4848

49+
func (h *HealthCheckCommand) CachedExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error {
50+
return h.ExecuteCommand(config, buildArgs)
51+
}
52+
4953
// String returns some information about the command for the image config history
5054
func (h *HealthCheckCommand) String() string {
5155
return h.cmd.String()

pkg/commands/label.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ func (r *LabelCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.B
3434
return updateLabels(r.cmd.Labels, config, buildArgs)
3535
}
3636

37+
func (r *LabelCommand) CachedExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error {
38+
return r.ExecuteCommand(config, buildArgs)
39+
}
40+
3741
func updateLabels(labels []instructions.KeyValuePair, config *v1.Config, buildArgs *dockerfile.BuildArgs) error {
3842
existingLabels := config.Labels
3943
if existingLabels == nil {

pkg/commands/onbuild.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ func (o *OnBuildCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile
4040
return nil
4141
}
4242

43+
func (o *OnBuildCommand) CachedExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error {
44+
return o.ExecuteCommand(config, buildArgs)
45+
}
46+
4347
// String returns some information about the command for the image config history
4448
func (o *OnBuildCommand) String() string {
4549
return o.cmd.String()

pkg/commands/run_marker.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ func (r *RunMarkerCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfi
4747
return nil
4848
}
4949

50+
func (r *RunMarkerCommand) CachedExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error {
51+
// TODO(mafredri): Check if we need to do more here.
52+
r.Files = []string{}
53+
return nil
54+
}
55+
5056
// String returns some information about the command for the image config
5157
func (r *RunMarkerCommand) String() string {
5258
return r.cmd.String()

pkg/commands/shell.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ func (s *ShellCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.B
3333
return nil
3434
}
3535

36+
func (s *ShellCommand) CachedExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error {
37+
return s.ExecuteCommand(config, buildArgs)
38+
}
39+
3640
// String returns some information about the command for the image config history
3741
func (s *ShellCommand) String() string {
3842
return s.cmd.String()

0 commit comments

Comments
 (0)