Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven dont use the local maven repo #8

Open
cmoulliard opened this issue Jan 27, 2020 · 31 comments
Open

Maven dont use the local maven repo #8

cmoulliard opened this issue Jan 27, 2020 · 31 comments

Comments

@cmoulliard
Copy link
Collaborator

Issue

When we do a supervisord build using the spring boot maven offline image which contains under /tmp/artefacts path, the Maven Spring Boot GAVS, then maven pull again the GAVs

https://88.99.12.170:8443/console/project/quarkus-demo/browse/pods/spring-boot-rest-794bd99d74-x2xp7?tab=logs

Is the maven command used correct ? @metacosm @geoand

Content of the maven offline repo

$ ls -la /tmp/artefacts
total 140
drwxrwx---. 17 root       root  4096 Jan 27 11:32 .
drwxrwxrwt.  1 root       root  4096 Jan 20 15:55 ..
drwxr-xr-x.  3 1000200000 root  4096 Jan 27 11:32 backport-util-concurrent
drwxr-xr-x.  3 1000200000 root  4096 Jan 27 11:29 ch
drwxr-xr-x.  3 1000200000 root  4096 Jan 27 11:31 classworlds
drwxr-xr-x.  8 1000200000 root  4096 Jan 27 11:30 com
drwxr-xr-x.  3 1000200000 root  4096 Jan 27 11:31 commons-cli
drwxr-xr-x.  3 1000200000 root  4096 Jan 27 11:29 commons-codec
drwxr-xr-x.  3 1000200000 root  4096 Jan 27 11:30 commons-io
-rw-r--r--.  1 1000200000 root 46592 Jan 27 11:28 component.tar
drwxr-xr-x.  9 1000200000 root  4096 Jan 27 11:30 io
drwxr-xr-x.  8 1000200000 root  4096 Jan 27 11:30 javax
drwxr-xr-x.  3 1000200000 root  4096 Jan 27 11:30 junit
drwxr-xr-x.  3 1000200000 root  4096 Jan 27 11:28 me
-rw-r--r--.  1 1000200000 root 14881 Jan 27 11:28 myproject.iml
drwxr-xr-x.  6 1000200000 root  4096 Jan 27 11:30 net
drwxr-xr-x. 26 1000200000 root  4096 Jan 27 11:30 org
-rw-r--r--.  1 1000200000 root  5801 Jan 27 11:28 pom.xml
drwxr-xr-x.  4 1000200000 root  4096 Jan 27 11:28 src
drwxr-xr-x.  3 1000200000 root  4096 Jan 27 11:31 target

Command executed within the pod by supervisord

$ cat /usr/local/bin/build
#!/bin/sh

mvn -f /usr/src/${CONTEXTPATH}/${MODULEDIRNAME}/pom.xml ${MAVEN_ARGS} package -DskipTests -DskipITs -Dmaven.repo.local=/tmp/artefacts && cp /usr/src/${CONTEXTPATH}/${MODULEDIRNAME}/target/${JARPATTERN}.jar /deployments/app.jar
@geoand
Copy link
Contributor

geoand commented Jan 27, 2020

It does indeed look correct. I would propose executing maven with -X to get a very verbose output of why this could be happening

@cmoulliard
Copy link
Collaborator Author

Could this step to fetch all the GAVs be wrong then or not complete ?

# Problem with the official maven plugin --> Not all maven plugins downloaded !!
# RUN mvn dependency:go-offline -f pom.xml -Dmaven.repo.local=/tmp/artefacts
RUN mvn de.qaware.maven:go-offline-maven-plugin:1.2.1:resolve-dependencies -f pom.xml -Dmaven.repo.local=/tmp/artefacts

@geoand
Copy link
Contributor

geoand commented Jan 27, 2020

I haven't used that plugin so I don't really know to be honest.

But like I said, adding -X to maven and then reading the log should give a good indication of why the artifacts are being downloaded again

@cmoulliard
Copy link
Collaborator Author

I need then to change the docker image used as we cannot pass such a parameter at the moment

@cmoulliard
Copy link
Collaborator Author

That looks good to me

Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T15:06:16Z)
--
  | Maven home: /usr/share/maven
  | Java version: 1.8.0_232, vendor: Oracle Corporation, runtime: /usr/local/openjdk-8/jre
  | Default locale: en, platform encoding: UTF-8
  | OS name: "linux", version: "4.14.129-bbrplus", arch: "amd64", family: "unix"
  | time="2020-01-27T12:25:13Z" level=debug msg="no auth required"
  | time="2020-01-27T12:25:14Z" level=debug msg="no auth required"
  | time="2020-01-27T12:25:15Z" level=debug msg="no auth required"
  | [DEBUG] Created new class realm maven.api
  | [DEBUG] Importing foreign packages into class realm maven.api
  | [DEBUG]   Imported: javax.annotation.* < plexus.core
  | [DEBUG]   Imported: javax.annotation.security.* < plexus.core
  | [DEBUG]   Imported: javax.enterprise.inject.* < plexus.core
  | [DEBUG]   Imported: javax.enterprise.util.* < plexus.core
  | [DEBUG]   Imported: javax.inject.* < plexus.core
  | [DEBUG]   Imported: org.apache.maven.* < plexus.core
  | [DEBUG]   Imported: org.apache.maven.artifact < plexus.core
  | [DEBUG]   Imported: org.apache.maven.classrealm < plexus.core
  | [DEBUG]   Imported: org.apache.maven.cli < plexus.core
  | [DEBUG]   Imported: org.apache.maven.configuration < plexus.core
  | [DEBUG]   Imported: org.apache.maven.exception < plexus.core
  | [DEBUG]   Imported: org.apache.maven.execution < plexus.core
  | [DEBUG]   Imported: org.apache.maven.execution.scope < plexus.core
  | [DEBUG]   Imported: org.apache.maven.lifecycle < plexus.core
  | [DEBUG]   Imported: org.apache.maven.model < plexus.core
  | [DEBUG]   Imported: org.apache.maven.monitor < plexus.core
  | [DEBUG]   Imported: org.apache.maven.plugin < plexus.core
  | [DEBUG]   Imported: org.apache.maven.profiles < plexus.core
  | [DEBUG]   Imported: org.apache.maven.project < plexus.core
  | [DEBUG]   Imported: org.apache.maven.reporting < plexus.core
  | [DEBUG]   Imported: org.apache.maven.repository < plexus.core
  | [DEBUG]   Imported: org.apache.maven.rtinfo < plexus.core
  | [DEBUG]   Imported: org.apache.maven.settings < plexus.core
  | [DEBUG]   Imported: org.apache.maven.toolchain < plexus.core
  | [DEBUG]   Imported: org.apache.maven.usability < plexus.core
  | [DEBUG]   Imported: org.apache.maven.wagon.* < plexus.core
  | [DEBUG]   Imported: org.apache.maven.wagon.authentication < plexus.core
  | [DEBUG]   Imported: org.apache.maven.wagon.authorization < plexus.core
  | [DEBUG]   Imported: org.apache.maven.wagon.events < plexus.core
  | [DEBUG]   Imported: org.apache.maven.wagon.observers < plexus.core
  | [DEBUG]   Imported: org.apache.maven.wagon.proxy < plexus.core
  | [DEBUG]   Imported: org.apache.maven.wagon.repository < plexus.core
  | [DEBUG]   Imported: org.apache.maven.wagon.resource < plexus.core
  | [DEBUG]   Imported: org.codehaus.classworlds < plexus.core
  | [DEBUG]   Imported: org.codehaus.plexus.* < plexus.core
  | [DEBUG]   Imported: org.codehaus.plexus.classworlds < plexus.core
  | [DEBUG]   Imported: org.codehaus.plexus.component < plexus.core
  | [DEBUG]   Imported: org.codehaus.plexus.configuration < plexus.core
  | [DEBUG]   Imported: org.codehaus.plexus.container < plexus.core
  | [DEBUG]   Imported: org.codehaus.plexus.context < plexus.core
  | [DEBUG]   Imported: org.codehaus.plexus.lifecycle < plexus.core
  | [DEBUG]   Imported: org.codehaus.plexus.logging < plexus.core
  | [DEBUG]   Imported: org.codehaus.plexus.personality < plexus.core
  | [DEBUG]   Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
  | [DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
  | [DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
  | [DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
  | [DEBUG]   Imported: org.eclipse.aether.* < plexus.core
  | [DEBUG]   Imported: org.eclipse.aether.artifact < plexus.core
  | [DEBUG]   Imported: org.eclipse.aether.collection < plexus.core
  | [DEBUG]   Imported: org.eclipse.aether.deployment < plexus.core
  | [DEBUG]   Imported: org.eclipse.aether.graph < plexus.core
  | [DEBUG]   Imported: org.eclipse.aether.impl < plexus.core
  | [DEBUG]   Imported: org.eclipse.aether.installation < plexus.core
  | [DEBUG]   Imported: org.eclipse.aether.internal.impl < plexus.core
  | [DEBUG]   Imported: org.eclipse.aether.metadata < plexus.core
  | [DEBUG]   Imported: org.eclipse.aether.repository < plexus.core
  | [DEBUG]   Imported: org.eclipse.aether.resolution < plexus.core
  | [DEBUG]   Imported: org.eclipse.aether.spi < plexus.core
  | [DEBUG]   Imported: org.eclipse.aether.transfer < plexus.core
  | [DEBUG]   Imported: org.eclipse.aether.version < plexus.core
  | [DEBUG]   Imported: org.fusesource.jansi.* < plexus.core
  | [DEBUG]   Imported: org.slf4j.* < plexus.core
  | [DEBUG]   Imported: org.slf4j.event.* < plexus.core
  | [DEBUG]   Imported: org.slf4j.helpers.* < plexus.core
  | [DEBUG]   Imported: org.slf4j.spi.* < plexus.core
  | [DEBUG] Populating class realm maven.api
  | time="2020-01-27T12:25:16Z" level=debug msg="no auth required"
  | [INFO] Error stacktraces are turned on.
  | [DEBUG] Message scheme: color
  | [DEBUG] Message styles: debug info warning error success failure strong mojo project
  | [DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
  | [DEBUG] Reading user settings from ?/.m2/settings.xml
  | [DEBUG] Reading global toolchains from /usr/share/maven/conf/toolchains.xml
  | [DEBUG] Reading user toolchains from ?/.m2/toolchains.xml
  | [DEBUG] Using local repository at /tmp/artefacts
  | [DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /tmp/artefacts
  | [INFO] Scanning for projects...
  | [DEBUG] Extension realms for project dev.snowdrop:myproject:jar:1.0.0-SNAPSHOT: (none)
  | [DEBUG] Looking up lifecycle mappings for packaging jar from ClassRealm[plexus.core, parent: null]
  | time="2020-01-27T12:25:17Z" level=debug msg="no auth required"
  | [DEBUG] === REACTOR BUILD PLAN ================================================
  | [DEBUG] Project: dev.snowdrop:myproject:jar:1.0.0-SNAPSHOT
  | [DEBUG] Tasks:   [package]
  | [DEBUG] Style:   Regular
  | [DEBUG] =======================================================================

@geoand
Copy link
Contributor

geoand commented Jan 27, 2020

There should be more output right?

@cmoulliard
Copy link
Collaborator Author

@geoand
Copy link
Contributor

geoand commented Jan 27, 2020

I don't see the artifacts being downloaded from maven in those logs. Am I missing something?

@cmoulliard
Copy link
Collaborator Author

No need to use docker, pod. We can easily reproduce locally the issue

Steps

  • Create the offline repo
git clone github.com:snowdrop/container-images && cd container-images/maven-offline-repo
 mvn de.qaware.maven:go-offline-maven-plugin:1.2.1:resolve-dependencies -f pom.xml -Dmaven.repo.local=./tmp
  • Use it from a spring boot project created using hal component create
 mvn -f pom.xml package  -DskipTests -DskipITs -Dmaven.repo.local=$PATH/container-images/maven-offline-repo/tmp
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< dev.snowdrop:myproject >-----------------------
[INFO] Building Spring Boot - JAX-RS REST Demo 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from redhat-early-access: https://maven.repository.redhat.com/earlyaccess/all/io/rest-assured/rest-assured/3.1.0/rest-assured-3.1.0.pom
Downloading from redhat-ga: https://maven.repository.redhat.com/ga/io/rest-assured/rest-assured/3.1.0/rest-assured-3.1.0.pom
Downloading from central: https://repo.maven.apache.org/maven2/io/rest-assured/rest-assured/3.1.0/rest-assured-3.1.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/io/rest-assured/rest-assured/3.1.0/rest-assured-3.1.0.pom (4.9 kB at 15 kB/s)
Downloading from redhat-early-access: https://maven.repository.redhat.com/earlyaccess/all/io/rest-assured/rest-assured-parent/3.1.0/rest-assured-parent-3.1.0.pom
Downloading from redhat-ga: https://maven.repository.redhat.com/ga/io/rest-assured/rest-assured-parent/3.1.0/rest-assured-parent-3.1.0.pom
Downloading from central: https://repo.maven.apache.org/maven2/io/rest-assured/rest-assured-parent/3.1.0/rest-assured-parent-3.1.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/io/rest-assured/rest-assured-parent/3.1.0/rest-assured-parent-3.1.0.pom (13 kB at 105 kB/s)
Downloading from redhat-early-access: https://maven.repository.redhat.com/earlyaccess/all/org/sonatype/oss/oss-parent/5/oss-parent-5.pom
Downloaded from redhat-early-access: https://maven.repository.redhat.com/earlyaccess/all/org/sonatype/oss/oss-parent/5/oss-parent-5.pom (4.1 kB at 21 kB/s)
Downloading from redhat-early-access: https://maven.repository.redhat.com/earlyaccess/all/org/codehaus/groovy/groovy/2.5.7/groovy-2.5.7.pom
Downloading from redhat-ga: https://maven.repository.redhat.com/ga/org/codehaus/groovy/groovy/2.5.7/groovy-2.5.7.pom
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/2.5.7/groovy-2.5.7.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/2.5.7/groovy-2.5.7.pom (24 kB at 246 kB/s)
Downloading from redhat-early-access: https://maven.repository.redhat.com/earlyaccess/all/org/codehaus/groovy/groovy-xml/2.5.7/groovy-xml-2.5.7.pom
Downloading from redhat-ga: https://maven.repository.redhat.com/ga/org/codehaus/groovy/groovy-xml/2.5.7/groovy-xml-2.5.7.pom
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy-xml/2.5.7/groovy-xml-2.5.7.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy-xml/2.5.7/groovy-xml-2.5.7.pom (22 kB at 235 kB/s)
Downloading from redhat-early-access: https://maven.repository.redhat.com/earlyaccess/all/org/apache/httpcomponents/httpmime/4.5.9/httpmime-4.5.9.pom
Downloading from redhat-ga: https://maven.repository.redhat.com/ga/org/apache/httpcomponents/httpmime/4.5.9/httpmime-4.5.9.pom
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/httpcomponents/httpmime/4.5.9/httpmime-4.5.9.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/httpcomponents/httpmime/4.5.9/httpmime-4.5.9.pom (5.2 kB at 52 kB/s)
Downloading from redhat-early-access: https://maven.repository.redhat.com/earlyaccess/all/org/ccil/cowan/tagsoup/tagsoup/1.2.1/tagsoup-1.2.1.pom
Downloaded from redhat-early-access: https://maven.repository.redhat.com/earlyaccess/all/org/ccil/cowan/tagsoup/tagsoup/1.2.1/tagsoup-1.2.1.pom (1.2 kB at 7.8 kB/s)
Downloading from redhat-early-access: https://maven.repository.redhat.com/earlyaccess/all/io/rest-assured/json-path/3.1.1/json-path-3.1.1.pom
Downloading from redhat-ga: https://maven.repository.redhat.com/ga/io/rest-assured/json-path/3.1.1/json-path-3.1.1.pom
...

@cmoulliard
Copy link
Collaborator Author

downloaded from maven in those logs

This is because the previously downloaded GAVs have been stored/saved under the PVC mounted volume ;-)

@cmoulliard
Copy link
Collaborator Author

We can easily reproduce locally the issue

I discovered the issue. Some testing gavs are not uploaded such as rest-assured, ... I will add them

@geoand
Copy link
Contributor

geoand commented Jan 27, 2020

OK, I am running the command locally to see what happens

@geoand
Copy link
Contributor

geoand commented Jan 27, 2020

When I tried the command with the proper paths specified, no artifacts were being downloaded

@cmoulliard
Copy link
Collaborator Author

I pushed an image including the missing GAVs needed for mvn test but log reports again that GAVS are pulled from maven repos

https://88.99.12.170:8443/console/project/quarkus-demo/browse/pods/spring-boot-rest-794bd99d74-2wvqj?tab=logs

@geoand
Copy link
Contributor

geoand commented Jan 27, 2020

This is what I did and worked:

git clone [email protected]:halkyonio/container-images.git
cd container-images/maven-offline-repo
mvn de.qaware.maven:go-offline-maven-plugin:1.2.1:resolve-dependencies -f pom.xml -Dmaven.repo.local=./tmp
mvn -f pom.xml package  -DskipTests -DskipITs -Dmaven.repo.local=./tmp/

No dependencies were downloaded during the execution of the last command.

@cmoulliard
Copy link
Collaborator Author

No dependencies were downloaded during the execution of the last command.

But that happens within the pod managed by the supervisord ...

@geoand
Copy link
Contributor

geoand commented Jan 27, 2020

Why would that make a difference? Isn't the pod still running, so the files should be intact, no?

Also didn't you mention that you reproduced the problem locally? That is why I tried it.

In any case since things work locally, the -Dmaven.repo.local and the de.qaware.maven:go-offline-maven-plugin do seem to work as expected

@cmoulliard
Copy link
Collaborator Author

Hmhmhm. I still dont understand why the mvn build starts within the pod, such messages still appear

Downloading from redhat-early-access: https://maven.repository.redhat.com/earlyaccess/all/me/snowdrop/spring-boot-bom/2.1.6.SP3/spring-boot-bom-2.1.6.SP3.pom
--
  | time="2020-01-27T13:11:26Z" level=debug msg="wait program exit" program=run
  | time="2020-01-27T13:11:26Z" level=error msg="program stopped with error:exit status 1" program=run
  | time="2020-01-27T13:11:26Z" level=info msg="success to start program" program=run
  | Error: Unable to access jarfile /deployments/app.jar
  | time="2020-01-27T13:11:27Z" level=debug msg="wait program exit" program=run
  | time="2020-01-27T13:11:27Z" level=error msg="program stopped with error:exit status 1" program=run
  | time="2020-01-27T13:11:27Z" level=info msg="success to start program" program=run
  | time="2020-01-27T13:11:27Z" level=debug msg="no auth required"
  | Error: Unable to access jarfile /deployments/app.jar
  | Downloading from redhat-ga: https://maven.repository.redhat.com/ga/me/snowdrop/spring-boot-bom/2.1.6.SP3/spring-boot-bom-2.1.6.SP3.pom
  | time="2020-01-27T13:11:28Z" level=debug msg="wait program exit" program=run
  | time="2020-01-27T13:11:28Z" level=error msg="program stopped with error:exit status 1" program=run
  | time="2020-01-27T13:11:28Z" level=info msg="success to start program" program=run
  | Error: Unable to access jarfile /deployments/app.jar
  | Downloading from central: https://repo.maven.apache.org/maven2/me/snowdrop/spring-boot-bom/2.1.6.SP3/spring-boot-bom-2.1.6.SP3.pom
  | Progress (1): 2.2/18 kBProgress (1): 5.0/18 kBProgress (1): 7.8/18 kBProgress (1): 11/18 kB Progress (1): 13/18 kBProgress (1): 16/18 kBProgress (1): 18 kB                      Downloaded from central: https://repo.maven.apache.org/maven2/me/snowdrop/spring-boot-bom/2.1.6.SP3/spring-boot-bom-2.1.6.SP3.pom  (18 kB at 45 kB/s)
  | Downloading from redhat-early-access: https://maven.repository.redhat.com/earlyaccess/all/org/infinispan/infinispan-bom/9.4.15.Final/infinispan-bom-9.4.15.Final.pom
  | Downloading from redhat-ga: https://maven.repository.redhat.com/ga/org/infinispan/infinispan-bom/9.4.15.Final/infinispan-bom-9.4.15.Final.pom
...

@geoand
Copy link
Contributor

geoand commented Jan 27, 2020

Maybe it's a file system permission issue?

@cmoulliard
Copy link
Collaborator Author

As the owner is defined to 1001:0 -

RUN mkdir -p /tmp/artefacts && chmod -R 777 /tmp/artefacts && chown -R 1001:0 /tmp/artefacts
, will it work if the pod is created with such permissions

$ ls -la /tmp
total 40
drwxrwxrwt.  1 root       root 4096 Jan 27 13:15 .
drwxr-xr-x.  1 root       root 4096 Jan 27 13:11 ..
drwxrwx---. 21 root       root 4096 Jan 27 13:15 artefacts
drwxr-xr-x.  1 root       root 4096 Jan 27 12:46 hsperfdata_root
drwxr-xr-x.  2 1000200000 root 4096 Jan 27 13:15 tomcat-docbase.4363577258656194957.8080
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:15 tomcat.5342335657704302092.8080

$ ls -la /tmp/artefacts/org/springframework/boot
total 88
drwxr-xr-x. 22 1000200000 root 4096 Jan 27 13:14 .
drwxr-xr-x. 17 1000200000 root 4096 Jan 27 13:13 ..
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:12 spring-boot
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:12 spring-boot-actuator
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:12 spring-boot-actuator-autoconfigure
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:12 spring-boot-autoconfigure
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:11 spring-boot-dependencies
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:13 spring-boot-devtools
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:14 spring-boot-loader-tools
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:11 spring-boot-maven-plugin
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:11 spring-boot-parent
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:12 spring-boot-starter
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:12 spring-boot-starter-actuator
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:12 spring-boot-starter-json
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:12 spring-boot-starter-logging
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:13 spring-boot-starter-test
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:12 spring-boot-starter-tomcat
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:12 spring-boot-starter-web
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:12 spring-boot-starters
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:13 spring-boot-test
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:13 spring-boot-test-autoconfigure
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:11 spring-boot-tools
$ ls -la /tmp/artefacts/org/springframework/boot/spring-boot-starter-tomcat
total 12
drwxr-xr-x.  3 1000200000 root 4096 Jan 27 13:12 .
drwxr-xr-x. 22 1000200000 root 4096 Jan 27 13:14 ..
drwxr-xr-x.  2 1000200000 root 4096 Jan 27 13:13 2.1.6.RELEASE
$ ls -la /tmp/artefacts/org/springframework/boot/spring-boot-starter-tomcat/2.1.6.RELEASE
total 36
drwxr-xr-x. 2 1000200000 root 4096 Jan 27 13:13 .
drwxr-xr-x. 3 1000200000 root 4096 Jan 27 13:12 ..
-rw-r--r--. 1 1000200000 root  248 Jan 27 13:13 _remote.repositories
-rw-r--r--. 1 1000200000 root  404 Jan 27 13:13 spring-boot-starter-tomcat-2.1.6.RELEASE.jar

@geoand
Copy link
Contributor

geoand commented Jan 27, 2020

I don't know to be honest

@cmoulliard
Copy link
Collaborator Author

Me too and if I try to change the value of the runAsUser to 1001, I got this error Error creating: pods "spring-boot-rest-6d45fdc864-" is forbidden: unable to validate against any security context constraint: [spec.containers[0].securityContext.securityContext.runAsUser: Invalid value: 1001: must be in the ranges: [1000200000, 1000209999]]

@metacosm
Copy link
Contributor

I have no idea, either…

@cmoulliard
Copy link
Collaborator Author

@cmoulliard
Copy link
Collaborator Author

cmoulliard commented Jan 27, 2020

The problem is that the folder /tmp/artefacts is empty

$ ls -la /tmp/artefacts
total 8
drwxrwx---. 2 root root 4096 Dec 10 11:14 .
drwxrwxrwt. 1 root root 4096 Jan 20 15:55 ..

even if the runtime image uses the maven offline image

NAME                RUNTIME NAME   VERSION         IMAGE
spring-boot-2.1.6   spring-boot    2.1.6.RELEASE   quay.io/halkyonio/spring-boot-offline-maven

So there is a mounting issue with the volume ...

PV volumes used behind the PVC for the pod is also empty

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    pv.kubernetes.io/bind-completed: "yes"
    pv.kubernetes.io/bound-by-controller: "yes"
  creationTimestamp: "2020-01-27T16:43:06Z"
  finalizers:
  - kubernetes.io/pvc-protection
  labels:
    app: spring-boot-rest
    component_cr: spring-boot-rest
    deployment: spring-boot-rest
  name: m2-data-spring-boot-rest
  namespace: quarkus-demo
  ownerReferences:
  - apiVersion: halkyon.io/v1beta1
    blockOwnerDeletion: true
    controller: true
    kind: Component
    name: spring-boot-rest
    uid: 17c0676e-4124-11ea-9fc1-96000038fe55
  resourceVersion: "10483749"
  selfLink: /api/v1/namespaces/quarkus-demo/persistentvolumeclaims/m2-data-spring-boot-rest
  uid: 17dd1488-4124-11ea-9fc1-96000038fe55
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  volumeName: pv0009

Hospath on the ssh machine

ls -la /var/lib/origin/openshift.local.clusterup/openshift.local.pv/pv0009
total 8
drwxrwx---.   2 root root 4096 Dec 10 12:14 .
drwxr-xr-x. 103 root root 4096 Dec 10 12:15 ..

@cmoulliard
Copy link
Collaborator Author

Offline repo is well packaged within the image

docker run -it spring-boot-offline-maven sh
# ls -la /tmp/artefacts
total 136
drwxrwxrwx  1 1001 root 4096 Jan 27 12:45 .
drwxrwxrwt  1 root root 4096 Jan 20 15:55 ..
drwxr-xr-x  3 root root 4096 Jan 27 12:45 antlr
drwxr-xr-x  3 root root 4096 Jan 27 12:45 aopalliance
drwxr-xr-x  4 root root 4096 Jan 27 12:45 asm

@cmoulliard
Copy link
Collaborator Author

FYI : First workaround to resolve the issue @metacosm @geoand

If we remove the mounted volume from the Deployment yml reosurce, then the /tmp/artecats is well present within the supervisord pod created

Lines removed
              name: m2-data-spring-boot-rest
            - mountPath: /tmp/artefacts
Terminal opened within the pod
$ ls -la /tmp/artefacts
total 264
drwxrwxrwx.  1 1001 root 4096 Jan 27 12:45 .
drwxrwxrwt.  1 root root 4096 Jan 20 15:55 ..
drwxr-xr-x.  3 root root 4096 Jan 27 12:45 antlr
drwxr-xr-x.  3 root root 4096 Jan 27 12:45 aopalliance
drwxr-xr-x.  4 root root 4096 Jan 27 12:45 asm
...

Question: Should we mount the PVC for /tmp/artefacts when it is packaged with the docker image ?

@geoand
Copy link
Contributor

geoand commented Jan 27, 2020

I don't have all the context here, but it seems like removing the mounted path fixes the problem, no?

If so, I would just go with that

@cmoulliard
Copy link
Collaborator Author

I don't have all the context here, but it seems like removing the mounted path fixes the problem, no?

Yes. I wondering if k8s allows to mount the content of an image within a pod and to also keep it under the PVC -> PV -> Host of the VM ???

@geoand
Copy link
Contributor

geoand commented Jan 27, 2020

I don't know for sure, but that doesn't sounds easy since what would happen if multiple pods wrote to the directory?

@cmoulliard
Copy link
Collaborator Author

if multiple pods wrote to the directory?

Then we will have a big maven repo ;-) I joke.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants