Skip to content

Commit f7e1bca

Browse files
Roberto.FranchinirohanKanojia
authored andcommitted
remove --config from command string generation add --node option to buildx command Signed-off-by: Roberto.Franchini <[email protected]>
1 parent cf48a2d commit f7e1bca

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/main/java/io/fabric8/maven/docker/service/BuildXService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected <C> void useBuilder(ProjectPaths projectPaths, ImageConfiguration imag
6363
BuildDirs buildDirs = new BuildDirs(projectPaths, imageConfig.getName());
6464

6565
Path configPath = getDockerStateDir(imageConfig.getBuildConfiguration(), buildDirs);
66-
List<String> buildX = Arrays.asList("docker", "--config", configPath.toString(), "buildx");
66+
List<String> buildX = Arrays.asList("docker", "buildx");
6767

6868
String builderName = createBuilder(configPath, buildX, imageConfig, buildDirs);
6969
Path configJson = configPath.resolve("config.json");
@@ -215,7 +215,7 @@ protected String createBuilder(Path configPath, List<String> buildX, ImageConfig
215215
Path builderPath = configPath.resolve(Paths.get("buildx", "instances", builderName));
216216
if(Files.notExists(builderPath)) {
217217
List<String> cmds = new ArrayList<>(buildX);
218-
append(cmds, "create", "--driver", "docker-container", "--name", builderName);
218+
append(cmds, "create", "--driver", "docker-container", "--name", builderName, "--node", builderName + "0");
219219
String buildConfig = buildXConfiguration.getConfigFile();
220220
if(buildConfig != null) {
221221
append(cmds, "--config",

src/test/java/io/fabric8/maven/docker/BuildMojoTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,15 @@ private void thenBuildxRun(String relativeConfigFile, String contextDir,
295295
String configFile = relativeConfigFile != null ? getOsDependentBuild(projectBaseDirectory.toPath(), relativeConfigFile) : null;
296296

297297
List<String> cmds =
298-
BuildXService.append(new ArrayList<>(), "docker", "--config", config, "buildx",
299-
"create", "--driver", "docker-container", "--name", "maven");
298+
BuildXService.append(new ArrayList<>(), "docker", "buildx",
299+
"create", "--driver", "docker-container", "--name", "maven" , "--node", "maven0");
300300
if (configFile != null) {
301301
BuildXService.append(cmds, "--config", configFile.replace('/', File.separatorChar));
302302
}
303303
Mockito.verify(exec).process(cmds);
304304

305305
if (nativePlatformIncluded) {
306-
List<String> buildXLine = BuildXService.append(new ArrayList<>(), "docker", "--config", config, "buildx",
306+
List<String> buildXLine = BuildXService.append(new ArrayList<>(), "docker", "buildx",
307307
"build", "--progress=plain", "--builder", "maven",
308308
"--platform", NATIVE_PLATFORM, "--tag", "example:latest", "--build-arg", "foo=bar");
309309

src/test/java/io/fabric8/maven/docker/service/RegistryServiceTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,11 +437,11 @@ private void thenBuildxImageHasBeenPushed(String providedBuilder, String relativ
437437
String builderName = providedBuilder != null ? providedBuilder : "maven";
438438

439439
if (providedBuilder == null) {
440-
Mockito.verify(exec).process(Arrays.asList("docker", "--config", config, "buildx", "create", "--driver", "docker-container", "--name", builderName));
440+
Mockito.verify(exec).process(Arrays.asList("docker", "buildx", "create", "--driver", "docker-container", "--name", builderName, "--node", builderName+"0"));
441441
}
442442

443443
List<String> cmds =
444-
BuildXService.append(new ArrayList<>(), "docker", "--config", config, "buildx", "build",
444+
BuildXService.append(new ArrayList<>(), "docker", "buildx", "build",
445445
"--progress=plain", "--builder", builderName, "--platform",
446446
"linux/amd64,linux/arm64", "--tag",
447447
new ImageName(imageConfiguration.getName()).getFullName(registry));

0 commit comments

Comments
 (0)