Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy file from SSH remote host to Jenkins Server

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.

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.

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).

EDIT :

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

like image 346
Not a bug Avatar asked Jan 21 '14 13:01

Not a bug


1 Answers

use sshpass command to send file in

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

sample command :

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

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

like image 65
Not a bug Avatar answered Sep 29 '22 11:09

Not a bug