Skip to content

Commit

Permalink
Fix Windows Tests
Browse files Browse the repository at this point in the history
+ fix path handling to be non-linux specific
+ cleanup path transformations
  • Loading branch information
Ondřej Mach authored and rohanKanojia committed Mar 6, 2021
1 parent ebf0730 commit fb3fe5d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main/java/io/fabric8/maven/docker/assembly/BuildDirs.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public class BuildDirs {
* Constructor building up the the output directories
*
* @param imageName image name for the image to build
* @param params mojo params holding base and global outptput dir
* @param params mojo params holding base and global output dir
*/
public BuildDirs(String imageName, MojoParameters params) {
this.params = params;
// Replace tag separator with a slash to avoid problems
// with OSs which gets confused by colons.
this.buildTopDir = imageName != null ? imageName.replace(':', '/') : null;
this.buildTopDir = imageName != null ? imageName.replace(':', File.separatorChar).replace("/", File.separator) : null;
}

public File getOutputDirectory() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,4 @@ static File getBuildTarArchive(ImageConfiguration imageConfiguration, MojoParame
BuildDirs buildDirs = new BuildDirs(imageConfiguration.getName(), mojoParameters);
return new File(buildDirs.getTemporaryRootDirectory(), ARCHIVE_FILE_NAME + "." + ArchiveCompression.none.getFileSuffix());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static void buildContainer(JibContainerBuilder jibContainerBuilder, TarIm
}

public static JibContainerBuilder containerFromImageConfiguration(String jibImageFormat,
ImageConfiguration imageConfiguration, Credential pullRegistryCredential) throws InvalidImageReferenceException {
ImageConfiguration imageConfiguration, Credential pullRegistryCredential) throws InvalidImageReferenceException {
final JibContainerBuilder containerBuilder = Jib.from(getRegistryImage(getBaseImage(imageConfiguration), pullRegistryCredential))
.setFormat(getImageFormat(jibImageFormat));
return populateContainerBuilderFromImageConfiguration(containerBuilder, imageConfiguration);
Expand Down Expand Up @@ -205,7 +205,7 @@ static Set<String> getAllImageTags(List<String> tags, String imageName) {

static ImageFormat getImageFormat(String jibImageFormat) {
if (jibImageFormat != null && jibImageFormat.toLowerCase().equalsIgnoreCase("oci")) {
return ImageFormat.OCI;
return ImageFormat.OCI;
}
return ImageFormat.Docker;
}
Expand Down Expand Up @@ -357,4 +357,4 @@ private static String generateProgressBar(double progress) {
.append("% complete")
.toString();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void testGetUrlFromEnvironment() throws MojoExecutionException, IOExcepti
String dockerHost = System.getenv("DOCKER_HOST");
if (dockerHost != null) {
assertEquals(dockerHost.replaceFirst("^tcp:/",""), detector.detectConnectionParameter(null, null).getUrl().replaceFirst("^https?:/", ""));
} else if (System.getProperty("os.name").equalsIgnoreCase("Windows 10")) {
} else if (System.getProperty("os.name").contains("Windows")) {
try {
assertEquals("npipe:////./pipe/docker_engine", detector.detectConnectionParameter(null, null).getUrl());
} catch (IllegalArgumentException expectedIfNoUnixSocket) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,4 @@ private ImageConfiguration getSampleImageConfiguration() {
.buildConfig(bc)
.build();
}
}
}

0 comments on commit fb3fe5d

Please sign in to comment.