[JIRA] (JENKINS-49762) withMaven fails to detect maven executable in kubernetes container
Title: Message Title Giuseppe Iannello edited a comment on JENKINS-49762 Re: withMaven fails to detect maven executable in kubernetes container Can be properly fixed after [https://github.com/fabric8io/kubernetes-client/pull/1045] is merged . Follow-up at https://issues.jenkins-ci.org/browse/JENKINS-50392 Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49762) withMaven fails to detect maven executable in kubernetes container
Title: Message Title Giuseppe Iannello commented on JENKINS-49762 Re: withMaven fails to detect maven executable in kubernetes container Can be properly fixed after https://github.com/fabric8io/kubernetes-client/pull/1045 is merged Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49762) withMaven fails to detect maven executable in kubernetes container
Title: Message Title Carlos Sanchez commented on JENKINS-49762 Re: withMaven fails to detect maven executable in kubernetes container No, there's none that I could figure out, although there's a PR that works around it https://github.com/jenkinsci/kubernetes-plugin/pull/242 Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49762) withMaven fails to detect maven executable in kubernetes container
Title: Message Title Giuseppe Iannello commented on JENKINS-49762 Re: withMaven fails to detect maven executable in kubernetes container I would like you to reconsider this issue. Using docker containers for builds helps with reproducibility and composability: it's trivial to replace a container with a different one and immediately check if there's any impact on the build process. This partially overlaps with one of the goals of the jenkins-maven plugin, but it's not enough to justify stopping using withMaven in a build: all the benefits coming from the publishers and artifacts fingerprinting are lost. Now, if you still insist to combine the two, you are possibly affected by the fact that the `container` block only supports sh based steps. All other steps will just ignore the `container` and execute inside the jnlp container. There's no actual reason not to "insist", as this seems to me the normal use case for a composable, docker-based build process: each container hosts a specific tool, everything runs in the same workspace. Your suggested distinct approaches have some fundamental flaws: plain agent pod: it ships with a JVM, and no maven. Switching to a different JVM is cumbersome, might break the jnlp slave itself, goes against the basic principles of containerization. skipping withMaven: losing all the benefits of the maven plugin Combining the two is the most logical option: sh steps will run in the maven container - and there's no problem with that, as even within a withMaven block, sh 'mvn ...' is the way to invoke the wrapper maven, and whatever cannot run in the maven container can run in the JNLP slave container, with the same workspace as the maven one. Carlos Sanchez isn't there a different way to return the exit code without having to inject a string into stdout? Add Comment
[JIRA] (JENKINS-49762) withMaven fails to detect maven executable in kubernetes container
Title: Message Title Stefan Betermieux closed an issue as Not A Defect Jenkins / JENKINS-49762 withMaven fails to detect maven executable in kubernetes container Change By: Stefan Betermieux Status: Open Closed Resolution: Not A Defect Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49762) withMaven fails to detect maven executable in kubernetes container
Title: Message Title Stefan Betermieux commented on JENKINS-49762 Re: withMaven fails to detect maven executable in kubernetes container Thanks for your quick response. I am using withMaven to provide a custom settings.xml from jenkins configuration. Maybe I should go with the alternate route and define settings as ConfigMap/Secrets, but I wanted to keep these kind of data under jenkins control. By the way, the withMaven directive is not ignoring the maven container, since it finds the maven executable in /usr/bin/mvn, which is not existing in the jnlp-container. But since I only need a custom settings file, the use of pipeline-maven-plugin is probably oversized. The issue can be closed. Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49762) withMaven fails to detect maven executable in kubernetes container
Title: Message Title Ioannis Canellos commented on JENKINS-49762 Re: withMaven fails to detect maven executable in kubernetes container The whole purpose of the podTemplate is to leverage kubernetes pods in order to setup the build environment (in this case maven). So, I'd say that it doesn't really make sense to combine with `withMaven`. I would either use one or the other. So the two distinct approaches are: Use plain agent pod (without specifying a maven container) with `withMaven`. Use the podTemplate to define the maven container and don't use `withMaven`. Now, if you still insist to combine the two, you are possibly affected by the fact that the `container` block only supports sh based steps. All other steps will just ignore the `container` and execute inside the jnlp container. This possibly is the case for `withMaven` Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49762) withMaven fails to detect maven executable in kubernetes container
Title: Message Title Stefan Betermieux updated an issue Jenkins / JENKINS-49762 withMaven fails to detect maven executable in kubernetes container Change By: Stefan Betermieux Hi,I am using withMaven() to execute maven with a custom settings.xml in a kubernetes pod. The detection of the maven executable is broken at the moment, since {code:java}org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution.readFromProcess("/bin/sh", "-c", "which mvn");{code} returns two lines of text: {code:none}/usr/bin/mvnEXITCODE 0{code}resulting in {{[withMaven] using Maven installation provided by the build agent with executable /usr/bin/mvn EXITCODE 0}}The exit code part seems to be generated by: {code:java}org.csanchez.jenkins.plugins.kubernetes.pipeline.ContainerExecDecorator.doExec(){code}I am not sure, why the last line is included, since when I execute {{/bin/sh -c 'which mvn'}} in the pipeline, I get only {{/usr/bin/mvn}} in return.Minimal pipeline example to reproduce:{code:java}def label = "mypod-${UUID.randomUUID().toString()}"podTemplate(label: label, containers: [containerTemplate(name: 'maven', image: 'maven:3.5.2-jdk-8', ttyEnabled: true, command: 'cat') ]) { node(label) {stage('Build') { container('maven') {withMaven(mavenSettingsConfig: 'maven-mirror-settings') { sh "ls -la ${MVN_CMD_DIR}" sh "cat ${MVN_CMD_DIR}/mvn*" sh "/bin/sh -c 'which mvn'" sh "mvn -v"} }} }} {code}Logs:{code:none}Running in Durability level: MAX_SURVIVABILITY[Pipeline] podTemplate[Pipeline] {[Pipeline] nodeStill waiting to schedule taskjenkins-slave-rg789-w09w8 is offlineRunning on jenkins-slave-rg789-w09w8 in /home/jenkins/workspace/Microservice[Pipeline] {[Pipeline] stage[Pipeline] { (Build)[Pipeline] container[Pipeline] {[Pipeline] withMaven[withMaven] Options: [][withMaven] Available options: [withMaven] using JDK installation provided by the build agent[withMaven] using Maven settings provided by the Jenkins Managed Configuration File 'maven-mirror-settings' [withMaven] using Maven settings.xml 'maven-mirror-settings' with NO Maven servers credentials provided by Jenkins[withMaven] using Maven global settings provided by the Jenkins global configuration. Maven global settings defined by 'DefaultSettingsProvider', NOT overriding it.Executing shell script inside container [maven] of pod [jenkins-slave-rg789-w09w8]Executing command: "/bin/sh" "-c" "which mvn" printf "EXITCODE %3d" $?; exit/usr/bin/mvnEXITCODE 0[withMaven] using Maven installation provided by the build agent with executable /usr/bin/mvn EXITCODE 0[Pipeline] {[Pipeline] sh[Microservice] Running shell script+ ls -la /home/jenkins/workspace/Microservice@tmp/withMavenef1a673dtotal 60drwxr-xr-x 2 1 1 4096 Feb 27 10:17 .drwxr-xr-x 4 1 1 4096 Feb 27 10:17 ..-rwxr-xr-x 1 1 1 202 Feb 27 10:17 mvn EXITCODE 0-rw-r--r-- 1 1 1 44289 Feb 27 10:17 pipeline-maven-spy.jar-rw-r--r-- 1 1 1 3432 Feb 27 10:17 settings.xml[Pipeline]
[JIRA] (JENKINS-49762) withMaven fails to detect maven executable in kubernetes container
Title: Message Title Stefan Betermieux created an issue Jenkins / JENKINS-49762 withMaven fails to detect maven executable in kubernetes container Issue Type: Bug Assignee: Ioannis Canellos Components: kubernetes-pipeline-plugin, pipeline-maven-plugin Created: 2018-02-27 10:23 Priority: Major Reporter: Stefan Betermieux Hi, I am using withMaven() to execute maven with a custom settings.xml in a kubernetes pod. The detection of the maven executable is broken at the moment, since org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution.readFromProcess("/bin/sh", "-c", "which mvn"); returns two lines of text: /usr/bin/mvn EXITCODE 0 resulting in [withMaven] using Maven installation provided by the build agent with executable /usr/bin/mvn EXITCODE 0 The exit code part seems to be generated by: org.csanchez.jenkins.plugins.kubernetes.pipeline.ContainerExecDecorator.doExec() I am not sure, why the last line is included, since when I execute /bin/sh -c 'which mvn' in the pipeline, I get only /usr/bin/mvn in return. Minimal pipeline example to reproduce: