Explorar o código

builder/windows: Don't set ArgsEscaped for RUN cache probe

Previously this was done indirectly - the `compare` function didn't
check the `ArgsEscaped`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 96d461d27e8da97b64620c94a4a1b2448511c058)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 44e6f3da6051299f17222d6e9a89c70f91bb817b)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Paweł Gronowski hai 1 ano
pai
achega
d5de9f7779
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  1. 8 1
      builder/dockerfile/dispatchers.go

+ 8 - 1
builder/dockerfile/dispatchers.go

@@ -345,9 +345,16 @@ func dispatchRun(d dispatchRequest, c *instructions.RunCommand) error {
 		saveCmd = prependEnvOnCmd(d.state.buildArgs, buildArgs, cmdFromArgs)
 	}
 
+	cacheArgsEscaped := argsEscaped
+	// ArgsEscaped is not persisted in the committed image on Windows.
+	// Use the original from previous build steps for cache probing.
+	if d.state.operatingSystem == "windows" {
+		cacheArgsEscaped = stateRunConfig.ArgsEscaped
+	}
+
 	runConfigForCacheProbe := copyRunConfig(stateRunConfig,
 		withCmd(saveCmd),
-		withArgsEscaped(argsEscaped),
+		withArgsEscaped(cacheArgsEscaped),
 		withEntrypointOverride(saveCmd, nil))
 	if hit, err := d.builder.probeCache(d.state, runConfigForCacheProbe); err != nil || hit {
 		return err