'How to use jenkins ssh-steps plugin to copy a remote directory

Im trying to copy a remote directory using jenkins ssh-steps plugin. But when i ran the script i get

4: not supported to get directory /home/jenkins/app-performance/target/gatling
at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:930)
at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:892)
at com.jcraft.jsch.ChannelSftp$get.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:141)
at org.hidetake.groovy.ssh.operation.SftpOperations$_getFile_closure1.doCall(SftpOperations.groovy:39)
at org.hidetake.groovy.ssh.operation.SftpOperations$_getFile_closure1.doCall(SftpOperations.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)

my pipeline code is

stage('Download report'){
            steps{
                script{
                    sshGet remote: remote, from: "app-performance/target/gatling" , into: "${env.WORKSPACE}/app-performance/"
                }
            }
        }

according to the plugin readme it should be possible to download directories using sshGet. any idea ?



Solution 1:[1]

the following piece of code worked for me in my scripted pipeline: def source='./deployments/logs/' def destination='deployments/' sshGet remote: remote, from: source, into: destination, override: true

at the end i could copy the log directory from the remote into the node.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SUNJIDA AFRIN