I have tried that code in both "Execute system Groovy script" and "Groovy
Postbuild". Same problem in either of them.
onsdag 15. april 2015 17.04.27 UTC+2 skrev Sverre Moe følgende:
>
> Tried an example code I found on GitHub. It fails excactly the same.
> It cannot serialize my class implementation of the FileCallable
>
> 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)
>>
>>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/c566a8c5-9771-4edf-bb7f-7c01fc82fb64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.