如何将文件从SSH远程主机复制到Jenkins服务器 [英] How to copy file from SSH remote host to Jenkins Server

查看:128
本文介绍了如何将文件从SSH远程主机复制到Jenkins服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们将Jenkins服务器用于日常构建过程,并通过SSH在远程主机上执行一些bash脚本.该脚本在远程主机上生成html日志文件.

We are using Jenkins server for our daily build process and executes some bash scripts on remote hosts over SSH. This scripts are generating html log files on remote hosts.

我们正在使用复制到从属插件将文件复制到从属计算机上,然后将通过ssh 插件发布到在构建过程中管理SSH会话.

We are using Copy to slave plugin to copy files on slave machines and Publish over ssh plugin to manage SSH sessions in build process.

现在的问题是,我们要将一些文件(脚本的日志文件)从远程ssh主机复制到Jenkins服务器. 对于相同的服务器,这将是可能的更好的选择(如果有插件,则更好).

Now the question is, We want to copy some files (log files of Scripts) from remote ssh host to Jenkins Server. Which will be possible and better option for the same (plugin will be better if any).

sshpass是一个选项,但是正在寻找任何插件或更好的方法来完成这项工作.

sshpass is an option, but looking for any plugin or better way to do the job.

推荐答案

使用

构建环境->使用ssh在远程主机上执行Shell脚本-> 发布构建脚本

Build Environment -> Execute Shell script on remote host using ssh -> Post build script

示例命令:

sshpass -p "password" scp path/of/file <new_server_ip>:/path/of/file

这将跳过scp命令的密码提示,并将密码提供给scp.

This will skip password prompt for scp command and will provide password to scp.

这篇关于如何将文件从SSH远程主机复制到Jenkins服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆