如何使用jenkins ssh-steps插件复制远程目录

tez616oj  于 2023-01-29  发布在  Jenkins
关注(0)|答案(1)|浏览(234)

我试图使用jenkins ssh-steps插件复制一个远程目录。但是当我运行脚本时,我得到

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)

我的管道代码是

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

根据插件自述文件,它应该可以下载目录使用sshGet。任何想法?

dldeef67

dldeef671#

下面的代码段在我的脚本化管道中运行良好:

def source='./deployments/logs/'
def destination='deployments/'
sshGet remote: remote, from: source, into: destination, override: true

最后,我可以将日志目录从远程复制到节点中。

相关问题