Skip to content

Commit

Permalink
fix (buildx) : Only add --config to buildx when config directory not …
Browse files Browse the repository at this point in the history
…empty

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
  • Loading branch information
rohanKanojia committed Jul 28, 2023
1 parent 0641d04 commit 8fa1ee2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ChangeLog

* **0.44-SNAPSHOT**:
- Make `--config` from buildx command string generation optional ([1673](https://github.com/fabric8io/docker-maven-plugin/pull/1673)) @robfrank

* **0.43.1** (2023-07-28):
- Resolve registry auth URL by registry ID ([1688](https://github.com/fabric8io/docker-maven-plugin/issues/1688)) @wajda
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ protected <C> void useBuilder(ProjectPaths projectPaths, ImageConfiguration imag
BuildDirs buildDirs = new BuildDirs(projectPaths, imageConfig.getName());

Path configPath = getDockerStateDir(imageConfig.getBuildConfiguration(), buildDirs);
List<String> buildX = Arrays.asList("docker", "buildx");
File[] configDirFiles = configPath.toFile().listFiles();
List<String> buildX = new ArrayList<>();
buildX.add("docker");
if (configDirFiles != null && configDirFiles.length > 0) {
buildX.add("--config");
buildX.add(configPath.toString());
}
buildX.add("buildx");

String builderName = createBuilder(configPath, buildX, imageConfig, buildDirs);
Path configJson = configPath.resolve("config.json");
Expand Down

0 comments on commit 8fa1ee2

Please sign in to comment.