-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix (buildx) : BuildX failing for Docker CLI on MacOS
+ Revert workaround for checking docker version for checking whether to add `docker --config` flag or not. We need to always add config to builder whenever it involves pulling or pushing images. + Currently Docker CLI on Mac OS don't seem to respect `--config` flag. When DMP tries to override default Docker config directory by providing `--config` flag, Docker CLI is no longer able to recognize buildx options. This seems to happening for scenarios where docker-buildx is installed in `~/.docker/cli-plugins`, whenever `docker --config new/path/config` is provided docker CLI uses new config path (which does not contain buildx). + Add a workaround to copy `docker-buildx` binary to temporary config directory created for docker buildx build. This seems to make docker recognize buildx even after config override. Signed-off-by: Rohan Kumar <[email protected]>
- Loading branch information
1 parent
21c0520
commit f58346e
Showing
8 changed files
with
110 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/test/java/io/fabric8/maven/docker/service/BuildXListWithConfigCommandTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package io.fabric8.maven.docker.service; | ||
|
||
import io.fabric8.maven.docker.util.Logger; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.io.TempDir; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.File; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertArrayEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.mockito.Mockito.mock; | ||
|
||
class BuildXListWithConfigCommandTest { | ||
@TempDir | ||
private File temporaryFolder; | ||
|
||
private BuildXService.BuildXListWithConfigCommand buildXListWithConfigCommand; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
Logger logger = mock(Logger.class); | ||
buildXListWithConfigCommand = new BuildXService.BuildXListWithConfigCommand(logger, temporaryFolder.toPath()); | ||
} | ||
|
||
@Test | ||
void getArgs() { | ||
assertArrayEquals(new String[] {"docker", "--config", temporaryFolder.getAbsolutePath(), "buildx", "ls"}, buildXListWithConfigCommand.getArgs()); | ||
} | ||
|
||
@Test | ||
void isSuccessFul() { | ||
// Given | ||
assertTrue(buildXListWithConfigCommand.isSuccessFul()); | ||
} | ||
} |
Oops, something went wrong.