import hudson.FilePath.FileCallable
import hudson.remoting.VirtualChannel
def jenkinsInstance = jenkins.model.Jenkins.getInstance()
def project = jenkinsInstance.getItem("myMatrixProject")
def rootProject = project.getRootProject()
def someWorkspace = rootProject.getSomeWorkspace()
try { def test = someWorkspace.act(new FileCallable<String>() { private static final long serialVersionUID = 1; @Override public String invoke(File file, VirtualChannel channel) { return "Testing Testing"; } });} catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); }
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 10: Can't have an abstract method in a non-abstract class. The class 'Script1$1' must be declared abstract or the method 'void checkRoles(org.jenkinsci.remoting.RoleChecker)' must be implemented. @ line 10, column 61. ct(new FileCallable<String>() {
--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/b2502c2c-8a02-46df-8bce-90ee10724090%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
remote file operation failed: /home/build/jenkins/workspace/myMatrixProject at hudson.remoting.Channel@54e95cec:Development-opensuse-x86_64: java.io.IOException: Unable to serialize hudson.FilePath$FileCallableWrapper@5a17f7bd
import hudson.FilePath.FileCallableimport hudson.remoting.VirtualChannelimport org.jenkinsci.remoting.RoleChecker
def jenkinsInstance = jenkins.model.Jenkins.getInstance()def project = jenkinsInstance.getItem("myMatrixProject")def rootProject = project.getRootProject()def someWorkspace = rootProject.getSomeWorkspace()
try { def test = someWorkspace.act(new FileCallable<String>() { private static final long serialVersionUID = 1; @Override public String invoke(File file, VirtualChannel channel) { return "Testing Testing"; }
@Override public void checkRoles(RoleChecker checker) throws SecurityException { } }); println test} catch (IOException e) {
println e.getMessage()} catch (InterruptedException e) {
println e.getMessage()}
import hudson.FilePath.FileCallableimport hudson.remoting.VirtualChannelimport org.jenkinsci.remoting.RoleChecker
def jenkinsInstance = jenkins.model.Jenkins.getInstance()def project = jenkinsInstance.getItem("myMatrixProject")def rootProject = project.getRootProject()def someWorkspace = rootProject.getSomeWorkspace()
private class MyFileCallable implements FileCallable<String> { private static final long serialVersionUID = 1L; @Override public String invoke(File file, VirtualChannel channel) throws IOException, InterruptedException {
return "Testing Testing"; } @Override public void checkRoles(RoleChecker checker) throws SecurityException { }}
try { def test = someWorkspace.act(new MyFileCallable());
println test} catch (IOException e) { println e.getMessage()} catch (InterruptedException e) { println e.getMessage()}
remote file operation failed: /home/build/jenkins/workspace/myMatrixProject at hudson.remoting.Channel@54e95cec:Development-opensuse-x86_64: java.io.IOException: Remote call on Development-opensuse-x86_64 failed
import java.util.*;import java.io.File;import java.io.IOException;
import org.apache.commons.io.FileUtils;
import hudson.FilePath.FileCallable;import hudson.remoting.VirtualChannel;import org.jenkinsci.remoting.RoleChecker
public class RemoteListDir implements FileCallable< Set<String> > { private static final long serialVersionUID = 1452212500874165127L;
public RemoteListDir() {} public Set<String> invoke(File workspace, VirtualChannel channel) throws IOException { manager.listener.logger.println "RemoteListDir invoke" Collection<File> list = FileUtils.listFiles(workspace, null, true); Set<String> set = new HashSet<String>(); for(File file : list) { String relativePath = FolderDiff.getRelativeName(file.getAbsolutePath(), workspace.getAbsolutePath()); set.add(relativePath); } return set;
}
@Override public void checkRoles(RoleChecker checker) throws SecurityException { }}
def project = manager.build.getProject()def someWorkspace = project.getSomeWorkspace()manager.listener.logger.println "Trying FileCallable on workspace " + someWorkspace
try { def files = someWorkspace.act(new RemoteListDir()); files.each { file -> manager.listener.logger.println file }} catch (IOException e) { e.printStackTrace(manager.listener.logger);} catch (InterruptedException e) { e.printStackTrace(manager.listener.logger);}
java.io.IOException: remote file operation failed: /home/build/jenkins/workspace/myLib-test/SLAVE_NODES/Development-opensuse-x86_64 at hudson.remoting.Channel@76706a10:Development-opensuse-x86_64: java.io.IOException: Remote call on Development-opensuse-x86_64 failed at hudson.FilePath.act(FilePath.java:985) at hudson.FilePath.act(FilePath.java:967) at hudson.FilePath$act.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:38) 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:361) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670) at hudson.model.Run.execute(Run.java:1766) at hudson.matrix.MatrixRun.run(MatrixRun.java:146) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374) Caused by: java.io.IOException: Remote call on Development-opensuse-x86_64 failed at hudson.remoting.Channel.call(Channel.java:761) at hudson.FilePath.act(FilePath.java:978) ... 20 more Caused by: java.lang.Error: Failed to deserialize the Callable object. at hudson.remoting.UserRequest.perform(UserRequest.java:105) at hudson.remoting.UserRequest.perform(UserRequest.java:49) at hudson.remoting.Request$2.run(Request.java:325) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) at ......remote call to Development-opensuse-x86_64(Native Method) at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1360) at hudson.remoting.UserResponse.retrieve(UserRequest.java:221) at hudson.remoting.Channel.call(Channel.java:753) ... 21 more Caused by: java.lang.IllegalArgumentException: Unable to locate class file for class RemoteListDir at hudson.remoting.Which.classFileUrl(Which.java:60)
Caused by: java.io.IOException: Remote call on Development-opensuse-x86_64 failed at hudson.remoting.Channel.call(Channel.java:761) at hudson.FilePath.act(FilePath.java:978) ... 28 more Caused by: java.lang.Error: Failed to deserialize the Callable object. at hudson.remoting.UserRequest.perform(UserRequest.java:105) at hudson.remoting.UserRequest.perform(UserRequest.java:49) at hudson.remoting.Request$2.run(Request.java:325) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) at ......remote call to Development-opensuse-x86_64(Native Method) at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1360) at hudson.remoting.UserResponse.retrieve(UserRequest.java:221) at hudson.remoting.Channel.call(Channel.java:753) ... 29 more Caused by: java.lang.IllegalArgumentException: Unable to locate class file for class MyClass$RemoteListDir