Skip to content

Commit e367f47

Browse files
geoandgsmet
authored andcommitted
Ensure that NativeImageBuildContainerRunner#setup is only invoked once
Relates to #49453 (cherry picked from commit 7714af8)
1 parent dabe0b2 commit e367f47

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildContainerRunner.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.ArrayList;
55
import java.util.Collections;
66
import java.util.List;
7+
import java.util.concurrent.atomic.AtomicBoolean;
78
import java.util.function.Function;
89
import java.util.stream.Stream;
910

@@ -22,6 +23,7 @@ public abstract class NativeImageBuildContainerRunner extends NativeImageBuildRu
2223
protected final ContainerRuntimeUtil.ContainerRuntime containerRuntime;
2324
String[] baseContainerRuntimeArgs;
2425
private final String containerName;
26+
private final AtomicBoolean setupInvoked = new AtomicBoolean();
2527

2628
protected NativeImageBuildContainerRunner(NativeConfig nativeConfig) {
2729
this.nativeConfig = nativeConfig;
@@ -39,7 +41,10 @@ public boolean isContainer() {
3941

4042
@Override
4143
public void setup(boolean processInheritIODisabled) {
42-
if (containerRuntime != ContainerRuntimeUtil.ContainerRuntime.UNAVAILABLE) {
44+
if (containerRuntime == ContainerRuntimeUtil.ContainerRuntime.UNAVAILABLE) {
45+
return;
46+
}
47+
if (setupInvoked.compareAndSet(false, true)) {
4348
log.infof("Using %s to run the native image builder", containerRuntime.getExecutableName());
4449
// we pull the docker image in order to give users an indication of which step the process is at
4550
// it's not strictly necessary we do this, however if we don't the subsequent version command
@@ -91,6 +96,7 @@ public void setup(boolean processInheritIODisabled) {
9196
pull(effectiveBuilderImage, processInheritIODisabled);
9297
}
9398
}
99+
94100
}
95101

96102
private void pull(String effectiveBuilderImage, boolean processInheritIODisabled) {

0 commit comments

Comments
 (0)