eclipse-archived / codewind

The official repository of the Eclipse Codewind project
https://codewind.dev
Eclipse Public License 2.0
114 stars 44 forks source link

SVT: Appsody microprofile app fails to build on Mac and Windows due to missing pom.xml #1690

Open jagraj opened 4 years ago

jagraj commented 4 years ago

Codewind version: 0.8.0 OS: Windows

Che version: IDE extension version: Codewind 0.8.0 IDE version: Eclipse - 2019-09 Kubernetes cluster:

Description:

Appsody eclipse microprofile fails to build on Windows. It is complaining about disk share issue and I already have disk shared in my docker. You can see the screenshot below.

Digest: sha256:038374ea014798d9cf1ad8f591eb0985039b7edaeb638f2cdc540747262ee7ed
Status: Downloaded newer image for appsody/init-controller:0.3.3
Running command: docker run --rm -P --name cw-appsodyempcw08svt-658a90c0-330e-11ea-8530-d17176b60629 --network codewind_network -v /C/codewind-data/appsodyempcw08svt/src:/project/user-app/src -v /C/codewind-data/appsodyempcw08svt/pom.xml:/project/user-app/pom.xml -v appsody-controller-0.3.3:/.appsody -t --entrypoint /.appsody/appsody-controller docker.io/appsody/java-microprofile:0.2 --mode=run
[Container] Running APPSODY_PREP command: ../validate.sh && mvn -B -Dmaven.repo.local=/mvn/repository install -DskipTests && /project/install-dev-deps.sh
[Container] Error: Could not find Maven pom.xml
[Container] 
[Container]   * The project directory (containing an .appsody-conf.yaml file) must contain a pom.xml file.
[Container]   * On Windows and MacOS, the project directory should also be shared with Docker: 
[Container]     - Win: https://docs.docker.com/docker-for-windows/#shared-drives
[Container]     - Mac: https://docs.docker.com/docker-for-mac/#file-sharing
[Container]   
[Container] [Error] FATAL error APPSODY_PREP command received an error.  The controller is exiting: exit status 1
[Error] Error in 'appsody run': exit status 1
Running development environment...
Pulling docker image docker.io/appsody/java-microprofile:0.2
Running command: docker pull docker.io/appsody/java-microprofile:0.2
0.2: Pulling from appsody/java-microprofile
Digest: sha256:44deecb2d0b2567e964444e9ba9d50417b355a0c3956237e0de74f1e248aa0db
Status: Image is up to date for appsody/java-microprofile:0.2
[Warning] Could not stat mount path: /root/.m2/repository
[Warning] Could not mount /root/.m2/repository:/mvn/repository because the local file was not found.
Running command: docker run --rm -P --name cw-appsodyempcw08svt-658a90c0-330e-11ea-8530-d17176b60629 --network codewind_network -v /C/codewind-data/appsodyempcw08svt/src:/project/user-app/src -v /C/codewind-data/appsodyempcw08svt/pom.xml:/project/user-app/pom.xml -v appsody-controller-0.3.3:/.appsody -t --entrypoint /.appsody/appsody-controller docker.io/appsody/java-microprofile:0.2 --mode=run
[Container] Running APPSODY_PREP command: ../validate.sh && mvn -B -Dmaven.repo.local=/mvn/repository install -DskipTests && /project/install-dev-deps.sh
[Container] Error: Could not find Maven pom.xml
[Container] 
[Container]   * The project directory (containing an .appsody-conf.yaml file) must contain a pom.xml file.
[Container]   * On Windows and MacOS, the project directory should also be shared with Docker: 
[Container]     - Win: https://docs.docker.com/docker-for-windows/#shared-drives
[Container]     - Mac: https://docs.docker.com/docker-for-mac/#file-sharing
[Container]   
[Container] [Error] FATAL error APPSODY_PREP command received an error.  The controller is exiting: exit status 1
[Error] Error in 'appsody run': exit status 1

image

Logs:

.log pfe.txt

Steps to reproduce:

  1. Install Codewind latest from Eclipse latest plugin.
  2. Create Appsody Eclipse Microprofile from the template.

Workaround:

jagraj commented 4 years ago

/priority stopship

malincoln commented 4 years ago

@sghung pls review. Thanks

sghung commented 4 years ago

Using Eclipse + codewind 0.8.0 + mac, I see this issue as well, s o we can rule this out as being a windows only issue. I will keep investigating and add comments with updates

sghung commented 4 years ago

Isolating the problem further, if calling it outside of codewind (i.e. appsody init on the OS), it does work.

The output is as follows:

Setting up the development environment Pulling docker image docker.io/appsody/java-microprofile:0.2 Running command: docker pull docker.io/appsody/java-microprofile:0.2 0.2: Pulling from appsody/java-microprofile Digest: sha256:44deecb2d0b2567e964444e9ba9d50417b355a0c3956237e0de74f1e248aa0db Status: Image is up to date for appsody/java-microprofile:0.2 docker.io/appsody/java-microprofile:0.2 [Warning] The stack image does not contain APPSODY_PROJECT_DIR. Using /project Running command: docker run --rm --entrypoint /bin/bash docker.io/appsody/java-microprofile:0.2 -c find /project -type f -name .appsody-init.sh Extracting project from development environment [Warning] The stack image does not contain APPSODY_PROJECT_DIR. Using /project [Warning] Path /Users/stevenhung/eclipse-workspaceDec2019_20/microprofilefail/pom.xml for mount points to a single file. Single file Docker mount paths cause unexpected behavior and will be deprecated in the future. Running command: docker create --name microprofilefail-extract -v /Users/stevenhung/.m2/repository:/mvn/repository -v /Users/stevenhung/eclipse-workspaceDec2019_20/microprofilefail/src:/project/user-app/src -v /Users/stevenhung/eclipse-workspaceDec2019_20/microprofilefail/pom.xml:/project/user-app/pom.xml docker.io/appsody/java-microprofile:0.2 Running command: docker cp microprofilefail-extract:/project /Users/stevenhung/.appsody/extract/microprofilefail Running command: docker rm microprofilefail-extract -f Project extracted to /Users/stevenhung/eclipse-workspaceDec2019_20/microprofilefail/.appsody_init Running command: ./.appsody-init.sh [InitScript] [INFO] Scanning for projects... [InitScript] [INFO] [InitScript] [INFO] -------------------< dev.appsody:java-microprofile >-------------------- [InitScript] [INFO] Building java-microprofile 0.2.21 [InitScript] [INFO] --------------------------------[ pom ]--------------------------------- [InitScript] [INFO] [InitScript] [INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (enforce-versions) @ java-microprofile --- [InitScript] [INFO] Skipping Rule Enforcement. [InitScript] [INFO] [InitScript] [INFO] --- maven-install-plugin:2.4:install (default-install) @ java-microprofile --- [InitScript] [INFO] Installing /Users/stevenhung/eclipse-workspaceDec2019_20/microprofilefail/.appsody_init/pom.xml to /Users/stevenhung/.m2/repository/dev/appsody/java-microprofile/0.2.21/java-microprofile-0.2.21.pom [InitScript] [INFO] ------------------------------------------------------------------------ [InitScript] [INFO] BUILD SUCCESS [InitScript] [INFO] ------------------------------------------------------------------------ [InitScript] [INFO] Total time: 0.884 s [InitScript] [INFO] Finished at: 2020-01-10T11:16:34-05:00 [InitScript] [INFO] ------------------------------------------------------------------------ Successfully initialized Appsody project with the stack and the default template.

When it fails on my machine (calling in codewind), I see the output: Running development environment... Pulling docker image docker.io/appsody/java-microprofile:0.2 Running command: docker pull docker.io/appsody/java-microprofile:0.2 0.2: Pulling from appsody/java-microprofile Digest: sha256:44deecb2d0b2567e964444e9ba9d50417b355a0c3956237e0de74f1e248aa0db Status: Image is up to date for appsody/java-microprofile:0.2 [Warning] Could not stat mount path: /root/.m2/repository [Warning] Could not mount /root/.m2/repository:/mvn/repository because the local file was not found. Running command: docker run --rm -P --name cw-microprofilefail-905c2730-33bf-11ea-9f23-91642edbb008 --network codewind_network -v /Users/stevenhung/codewind-data/microprofilefail/src:/project/user-app/src -v /Users/stevenhung/codewind-data/microprofilefail/pom.xml:/project/user-app/pom.xml -v appsody-controller-0.3.3:/.appsody -t --entrypoint /.appsody/appsody-controller docker.io/appsody/java-microprofile:0.2 --mode=run [Container] Running APPSODY_PREP command: ../validate.sh && mvn -B -Dmaven.repo.local=/mvn/repository install -DskipTests && /project/install-dev-deps.sh [Container] Error: Could not find Maven pom.xml [Container] [Container] The project directory (containing an .appsody-conf.yaml file) must contain a pom.xml file. [Container] On Windows and MacOS, the project directory should also be shared with Docker: [Container] - Win: https://docs.docker.com/docker-for-windows/#shared-drives [Container] - Mac: https://docs.docker.com/docker-for-mac/#file-sharing [Container]
[Container] [Error] FATAL error APPSODY_PREP command received an error. The controller is exiting: exit status 1 [Error] Error in 'appsody run': exit status 1

sghung commented 4 years ago

I tried creating 3 more projects and all of them worked. It could be a timing issue as it isn't reproducible 100% of the time.

sghung commented 4 years ago

I reset my codewind environment again (cleared all the projects). I cannot reproduce the scenario despite being able to on Friday. I am using the same home network that I had hit the problem originally with. I had hoped to investigate the theory that the pom.xml isn't available at the time the appsody run was called, but I cannot verify.

@jagraj in your error scenario above, if you call a build again after, does it fix the problem? Another colleague and I ran into that problem on Friday but on a re-build, it ended up fixing the problem. That might isolate the issue more towards a timing issue as opposed to a sharing volume issue.

sghung commented 4 years ago

Update: I can consistently re-create this issue and get the error shown at the end of the comment. If I stop codewind and start it up, then start eclipse + codewind, and for the first appsody microprofile it will always hit the error.

Observations:

[Warning] Could not stat mount path: /root/.m2/repository [Warning] Could not mount /root/.m2/repository:/mvn/repository because the local file was not found. Running command: docker run --rm -P --name cw-failingappsodytwo-9df0db10-362c-11ea-bed5-d7bff229df3a --network codewind_network -v /Users/stevenhung/codewind-data/failingappsodytwo/src:/project/user-app/src -v /Users/stevenhung/codewind-data/failingappsodytwo/pom.xml:/project/user-app/pom.xml -v appsody-controller-0.3.3:/.appsody -t --entrypoint /.appsody/appsody-controller docker.io/appsody/java-microprofile:0.2 --mode=run [Container] Running APPSODY_PREP command: ../validate.sh && mvn -B -Dmaven.repo.local=/mvn/repository install -DskipTests && /project/install-dev-deps.sh [Container] Installing parent dev.appsody:java-microprofile:0.2.21 [Container] [INFO] Scanning for projects... [Container] [INFO] [Container] [INFO] -------------------< dev.appsody:java-microprofile >-------------------- [Container] [INFO] Building java-microprofile 0.2.21 [Container] [INFO] --------------------------------[ pom ]--------------------------------- [Container] [INFO] [Container] [INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (enforce-versions) @ java-microprofile --- [Container] [INFO] Skipping Rule Enforcement. [Container] [INFO] [Container] [INFO] --- maven-install-plugin:2.4:install (default-install) @ java-microprofile --- [Container] [INFO] Installing /project/user-app/../pom.xml to /mvn/repository/dev/appsody/java-microprofile/0.2.21/java-microprofile-0.2.21.pom [Container] [INFO] ------------------------------------------------------------------------ [Container] [INFO] BUILD SUCCESS [Container] [INFO] ------------------------------------------------------------------------ [Container] [INFO] Total time: 1.315 s [Container] [INFO] Finished at: 2020-01-13T17:46:39Z [Container] [INFO] ------------------------------------------------------------------------ [Container] failed to load external entity "pom.xml" [Container] failed to load external entity "pom.xml" [Container] failed to load external entity "pom.xml" [Container] Project pom.xml is missing the required parent: [Container] [Container] [Container] dev.appsody [Container] java-microprofile [Container] [Container] [Container] [Container]
[Container] [Error] FATAL error APPSODY_PREP command received an error. The controller is exiting: exit status 1 [Error] Error in 'appsody run': exit status 1

sghung commented 4 years ago

I tried to re-direct the contents of the directory to a .log file. But I couldn't reproduce the problem anymore. It might have affected the timing. Basically in the appsody extension, I log ls -la and also log pom.xml so we can be sure what is there. I will keep trying to reproduce with this extra debugging.

jagraj commented 4 years ago

I tried on my windows VM after recovering my docker issues. Out of two projects, the 2nd appsody microprofile project failed to build with the following issue.

[Container] [INFO] Total time:  5.334 s
[Container] [INFO] Finished at: 2020-01-15T20:20:45Z
[Container] [INFO] ------------------------------------------------------------------------
[Container] failed to load external entity "pom.xml"
[Container] failed to load external entity "pom.xml"
[Container] failed to load external entity "pom.xml"
[Container] Project pom.xml is missing the required parent:
[Container] 
[Container]   <parent>
[Container]     <groupId>dev.appsody</groupId>
[Container]     <artifactId>java-microprofile</artifactId>
[Container]     <version></version>
[Container]     <relativePath/>
[Container]   </parent>
[Container]   
[Container] [Error] FATAL error APPSODY_PREP command received an error.  The controller is exiting: exit status 1
[Error] Error in 'appsody run': exit status 1
makandre commented 4 years ago

I could not readily reproduce this on VSCode (maybe once out of many attempts), but on Eclipse I do see it (I'm on Mac). As noted by others it usually happens on first create of the project but a manual build request resolves the problem.

FFIW, I do not see this problem with the new java-openliberty stack, which is meant to be the replacement for the java-microprofile stack

makandre commented 4 years ago

Shelling into the appsody container in the short time before it go does, this is what I see:

root@b8335126f5d7:/project/user-app# ls -la
ls: cannot access 'pom.xml': No such file or directory
total 16
drwxr-xr-x 1 root root 4096 Jan 16 19:41 .
drwxr-xr-x 1 root root 4096 Nov 26 15:02 ..
-????????? ? ?    ?       ?            ? pom.xml
drwxrwxr-x 4 root root  128 Jan 16 19:41 src
drwxr-xr-x 3 root root 4096 Nov 26 15:02 target

I'm really wondering whether or not this is another manifestation of the single file mount issue that we encountered in #1202? (and as noted above the java-openliberty stack does not have this issue; it also doesn't single file mount the pom.xml)

makandre commented 4 years ago

I removed all the m2e components from my Eclipse install, and after that, I do not run into this problem any longer.

This strongly suggest to me that we are seeing something very similar to what I noted here https://github.com/eclipse/codewind/issues/1202#issuecomment-557596131

Basically:

malincoln commented 4 years ago

@sghung was there a workaround you were going to merge?

makandre commented 4 years ago

I'm not aware of a code workaround (but maybe @sghung did find one). A manual workaround is to simply request to build the project.

Given that the replacement java-openliberty stack is out and the java-microprofile stack is to be (eventually) removed, I wonder if we can put a note in the docs or what's new telling users to use the new stack and lower the priority of this issue?

sghung commented 4 years ago

The workaround that Jag and I had used (when we hit similar issues about missing pom.xml) was to run a manual build again and it would fix the problem.

sghung commented 4 years ago

From the investigation above, we suspect the cause is due to the single file mount in the microprofile stack (reported here: https://github.com/appsody/appsody/issues/794). The Open Liberty stack does not have single file mounts and is used to replace the microprofile stack.

Right now, we recommend people use the java-openliberty stack instead of the java-microprofile

sghung commented 4 years ago

Jag agreed to remove the stopship tag

malincoln commented 4 years ago

removing 0.8.0 release tag