Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-29674

Maven project not supported by the build environment plugin

      When using the job type "Maven project" the option "Build inside a Docker container" isn't displayed within the Build Environment settings.

          [JENKINS-29674] Maven project not supported by the build environment plugin

          This is by intention, maven job type won't work with a docker container as it open an arbitrary socket for communication between slave agent and maven process, which we can't discover at container launch time
          Also, maven job type do require a maven installation set, which does not make much sense in this plugin context, as you should rely on maven installed within the image (for example, using maven official image)

          Nicolas De Loof added a comment - This is by intention, maven job type won't work with a docker container as it open an arbitrary socket for communication between slave agent and maven process, which we can't discover at container launch time Also, maven job type do require a maven installation set, which does not make much sense in this plugin context, as you should rely on maven installed within the image (for example, using maven official image)

          Could maybe be considered in the future but will require to refactor maven plugin as well to make communication socket configurable and use maven from PATH

          Nicolas De Loof added a comment - Could maybe be considered in the future but will require to refactor maven plugin as well to make communication socket configurable and use maven from PATH

          some blockers on getting maven job type supported

          • maven job type do rely on locating jenkins slave remoting and maven-plugin jars so it can build the adequate maven process classpath. So identified paths need to be available in container. Mounting the whole slave root directory (not just workspace and tools) could solve this issue (at least when using a remote slave). I wonder this could have side effects, I'm not a big fan on mounting too much folders inside container.
          • maven agent do communicate with slave on a local TCP socket. But when ran inside docker, maven agent has to connect to dockerhost, not localhost. https://github.com/jenkinsci/docker-custom-build-environment-plugin/commit/79b65a0483a9ea5b0614dd8341019b465cb3981b do expose dockerhost IP to build container. But need maven-plugin to use it in replacement for localhost. see JENKINS-21746

          Nicolas De Loof added a comment - some blockers on getting maven job type supported maven job type do rely on locating jenkins slave remoting and maven-plugin jars so it can build the adequate maven process classpath. So identified paths need to be available in container. Mounting the whole slave root directory (not just workspace and tools) could solve this issue (at least when using a remote slave). I wonder this could have side effects, I'm not a big fan on mounting too much folders inside container. maven agent do communicate with slave on a local TCP socket. But when ran inside docker, maven agent has to connect to dockerhost, not localhost. https://github.com/jenkinsci/docker-custom-build-environment-plugin/commit/79b65a0483a9ea5b0614dd8341019b465cb3981b do expose dockerhost IP to build container. But need maven-plugin to use it in replacement for localhost. see JENKINS-21746

          Proposed https://github.com/jenkinsci/maven-plugin/pull/51 - extension point so other plugins can contribute discovery of the maven -> slave agent callback socket host IP. If/when approved, could use it to declare "dockerhost" as hostname to connect to.

          Nicolas De Loof added a comment - Proposed https://github.com/jenkinsci/maven-plugin/pull/51 - extension point so other plugins can contribute discovery of the maven -> slave agent callback socket host IP. If/when approved, could use it to declare "dockerhost" as hostname to connect to.

          Manuel Ryan added a comment -

          The maven plugin 2.14 which was released 5 days ago contains your changes from maven-plugin PR 51 and maven-interceptors PR 8 right ?

          Can you re-open this issue and see if you can make a version of the custom-build-environment plugin that is compatible with maven-plugin 2.14 ?

          Manuel Ryan added a comment - The maven plugin 2.14 which was released 5 days ago contains your changes from maven-plugin PR 51 and maven-interceptors PR 8 right ? Can you re-open this issue and see if you can make a version of the custom-build-environment plugin that is compatible with maven-plugin 2.14 ?

            ndeloof Nicolas De Loof
            emicify Michael Süß
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: