Jkube: build errors on windows 10

Created on 25 Jun 2020  路  14Comments  路  Source: eclipse/jkube

on mvn k8s:build i get the following output:

[INFO] Scanning for projects...
[INFO]
[INFO] -----------< org.eclipse.jkube.quickstarts.maven:helloworld >-----------
[INFO] Building Eclipse JKube :: Quickstarts :: Maven :: Hello World 1.0.0-alpha-4
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- kubernetes-maven-plugin:1.0.0-alpha-4:build (default-cli) @ helloworld ---
[INFO] k8s: Running in Kubernetes mode
[INFO] k8s: Building Docker image in Kubernetes mode
[ERROR] k8s: Failed to execute the build ['basedir' must be an absolute path starting with / (and not '/maven')]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.681 s
[INFO] Finished at: 2020-06-25T08:38:32-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.jkube:kubernetes-maven-plugin:1.0.0-alpha-4:build (default-cli) on project helloworld: Failed to execute the build: 'basedir' must be an absolute path starting with / (and not '/maven') -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

docker version:

# docker --version
Docker version 19.03.8, build afacb8b

maven version:

# mvn --version
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T15:00:29-04:00)
...
Java version: 1.8.0_211, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_211\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
bug

Most helpful comment

I will play around when I have some time later today - if I see something useful I will submit a PR

All 14 comments

@duke-arioch : Thanks for your bug report. Could you please share your logs with -X enabled? Do you have a sample project we can use in order to reproduce your issue?

Thanks Rohan! I have added the below file with -X.

I did not do anything but clone the repo per the instructions and then execute the maven command

(edit) - this output was from the mvn k8s:build command. after the full command failed, i broke it up and found mvn clean install was successful. then executed k8s:build afterwards on its own

out.txt

ah, looks like this line the culprit, I think platform-independent File.separator should be used here:
https://github.com/eclipse/jkube/blob/b573deb75fb5d6a78263c3a3e0a73e73923186be/jkube-kit/config/image/src/main/java/org/eclipse/jkube/kit/config/image/build/DockerFileBuilder.java#L376-L380

Would you like to create a PR to fix this?

I wonder why our windows test is not failing

Quick check I did not see the test setting the base dir - maybe i missed it? default is '/maven' in any case, which would not trigger it.

Quick check I did not see the test setting the base dir - maybe i missed it? default is '/maven' in any case, which would not trigger it.

Yes, but I don't see this being overridden in the hello-world example either. We need to check.

Anyway, before implementing the (easy) fix, we first need to modify the windows integration test to make it fail. We need guarantees and to make sure that any other change we make in the future won't break JKube for Windows users.

ah, looks like this line the culprit, I think platform-independent File.separator should be used here:
https://github.com/eclipse/jkube/blob/b573deb75fb5d6a78263c3a3e0a73e73923186be/jkube-kit/config/image/src/main/java/org/eclipse/jkube/kit/config/image/build/DockerFileBuilder.java#L376-L380

Would you like to create a PR to fix this?

Also, probably something like !new File(dir).isAbsolute() is what we need, absolute paths never start with \ in Windows (they start with a drive letter)

i think i got it - was considering helping out with a pull request but wanted to get build going first - i saw this:

Running org.eclipse.jkube.kit.common.util.EnvUtilTest
Tests run: 32, Failures: 2, Errors: 0, Skipped: 1, Time elapsed: 0.309 sec <<< FAILURE! - in org.eclipse.jkube.kit.common.util.EnvUtilTest
testPrepareAbsoluteSourceDirPath(org.eclipse.jkube.kit.common.util.EnvUtilTest)  Time elapsed: 0 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<test-project[/target/]testDir> but was:<test-project[\target\]testDir>
        at org.eclipse.jkube.kit.common.util.EnvUtilTest.testPrepareAbsoluteSourceDirPath(EnvUtilTest.java:270)

Our tests are not platform independent, many of them will fail on windows :(

Not sure that the failing test is related to our current problem. If you can, maybe try out this project in your machine: https://github.com/jkubeio/jkube-integration-tests/tree/master/projects-to-be-tested/windows (Although maybe it won't work either because it's using a windows containers image, and you're probably running regular Docker)

I will play around when I have some time later today - if I see something useful I will submit a PR

Let me know if there's a slack or discord etc for this project - in the meantime, where does the code under test execute - is it part of the build, ie creating the image or otherwise working outside of it, or is it going into the image? and what drives whether a windows or linux image is built? and yes - I am running docker for windows, and using their default WSL2 image. Let me know if there's a better forum for all my dumb questions - as I am new to this project!

Same Issue, Eclipse on Windows 10 is not working. Is there any fix I can apply?

You can ask your questions on our gitter channel https://gitter.im/eclipse/jkube

GitHub actions environment for windows is run in some sort of *nix compatible shell, so it will be hard to upgrade our IT to fail for this.
I'll try a complete build-apply iteration on my Windows machine and fix this or any other bug I find. We can take care of IT later.

Was this page helpful?
0 / 5 - 0 ratings