-
Bug
-
Resolution: Won't Fix
-
Major
-
Running CloudBees Enterprise Jenkins - 15.11 - 1.625.3.1 on RHEL, Tomcat8.0.30/JDK1.8.0_72
Plugin Version 2.2.2
The script i am using the in postbuild-step is as follows, I am trying to extract the MAVEN_VERSION from the file and it doesnt find the file on remote slave, however when i execute the same on local slave the same works fine,
So i believe the Plugin needs to be updated to have a VirtualChannel open to the remote workspace for parsing file, I havent looked at the code yet but if anyone has a quick fix, can some one help with this
import jenkins.util.*;
import jenkins.model.*;
def thr = Thread.currentThread();
def currentBuild = thr?.executable;
def workspace = currentBuild.getModuleRoot().absolutize().toString();
def project = new XmlSlurper().parse(new File("$workspace/pom.xml"))
def param = new hudson.model.StringParameterValue("MAVEN_VERSION", project.version.toString())
currentBuild.addAction(new hudson.model.ParametersAction(param));
Error in log -
ERROR: Failed to evaluate groovy script.
java.io.FileNotFoundException: /prod/jenkins/test-slave/workspace/MYProjectBuild/pom.xml (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at groovy.util.XmlSlurper.parse(XmlSlurper.java:160)
at groovy.util.XmlSlurper$parse.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at Script1.run(Script1.groovy:6)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:580)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:618)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:166)
at org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder.perform(GroovyPostbuildRecorder.java:362)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
at hudson.model.Run.execute(Run.java:1766)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:408)