Jenkins Pipeline ssh 步骤 sshPut all of a file type
Jenkins Pipeline ssh steps sshPut all of a file type
我正在尝试使用 SSH 步骤将所有特定文件类型移动到另一台服务器。我特别尝试使用 sshPut 移动所有 .txt 文件。这是我正在使用的行:
sshPut remote: remote, from: "*.txt", into: "/the/destination/folder/"
这是 Jenkins 抛出的错误:
java.lang.IllegalArgumentException: /the/source/folder/*.txt does not exist.
我知道我已经正确设置了 sshsteps。我已经能够在远程服务器上推送单个文件和 运行 一些命令。 sshPut 甚至可以处理通配符吗?如果可能的话,我试图避免压缩所有内容并在远程服务器上进行解压缩,但如果这是需要发生的事情,那就是需要发生的事情。我也有不使用 ssh 密钥的严格说明,所以 scp 目前是不可能的。
更新:根据 susenj 的建议,我将行更改为:
sshPut remote: remote, from: "./", filterRegex: /\.txt$/, into: "/the/destination/folder/"
这奏效了。
sshPut 的正则表达式使用 Groovy 语法。请参考:https://github.com/jenkinsci/ssh-steps-plugin#sshput
您可以尝试的是:
sshPut remote: remote, from: "./", filterRegex: /.txt$/, into: "/the/destination/folder/"
我正在尝试使用 SSH 步骤将所有特定文件类型移动到另一台服务器。我特别尝试使用 sshPut 移动所有 .txt 文件。这是我正在使用的行:
sshPut remote: remote, from: "*.txt", into: "/the/destination/folder/"
这是 Jenkins 抛出的错误:
java.lang.IllegalArgumentException: /the/source/folder/*.txt does not exist.
我知道我已经正确设置了 sshsteps。我已经能够在远程服务器上推送单个文件和 运行 一些命令。 sshPut 甚至可以处理通配符吗?如果可能的话,我试图避免压缩所有内容并在远程服务器上进行解压缩,但如果这是需要发生的事情,那就是需要发生的事情。我也有不使用 ssh 密钥的严格说明,所以 scp 目前是不可能的。
更新:根据 susenj 的建议,我将行更改为:
sshPut remote: remote, from: "./", filterRegex: /\.txt$/, into: "/the/destination/folder/"
这奏效了。
sshPut 的正则表达式使用 Groovy 语法。请参考:https://github.com/jenkinsci/ssh-steps-plugin#sshput
您可以尝试的是:
sshPut remote: remote, from: "./", filterRegex: /.txt$/, into: "/the/destination/folder/"