Jenkins ssh and pull (copy) files

5,466 views
Skip to first unread message

marathiboy

unread,
Jul 5, 2012, 9:39:15 AM7/5/12
to jenkins...@googlegroups.com
Hello,

I need to pull files from remote machine and send it via email as
attachment. Once the files are on Jenkins server, I can do the rest.

In order to copy (pull) files from the remote server, is there any plugin or
how can I use something like

ssh target_address cat remotefile > localfile

using ssh plugin?

Thanks

S

--
View this message in context: http://jenkins.361315.n4.nabble.com/Jenkins-ssh-and-pull-copy-files-tp4633889.html
Sent from the Jenkins users mailing list archive at Nabble.com.

Sami Tikka

unread,
Jul 5, 2012, 4:21:59 PM7/5/12
to jenkins...@googlegroups.com
So, making a free-style job with a shell build step which executes something like "ssh target_address cat remotefile > localfile" would not work for you?

-- Sami

Ligade, Shailesh [USA]

unread,
Jul 6, 2012, 8:15:55 AM7/6/12
to jenkins...@googlegroups.com
Thanks,

No this is doable I guess..what I am trying to do is:

Using ssh plugin, copy wars to target environment, then I run a script on target environment to deploy those wars. If within the script, I figure out there was error in deployment, I want to get deployment logs back to Jenkins so that I can send them as email attachment.

So I need logs, only if I detect error. And logs can be huge..so I just don't want to cat them with in my script and let it go to console out..So I was looking for elegent elegant solution. I guess, I can set up another job with ssh command you have mentioned, if my deployment job fails due to deployment error (some parameter to the new job)..

Thanks

S

Fred G

unread,
Jul 6, 2012, 9:22:37 AM7/6/12
to jenkins...@googlegroups.com
Hi,

The Copy To Slave Plugin (https://wiki.jenkins-ci.org/display/JENKINS/Copy+To+Slave+Plugin)
can copy back files to the master. Currently this is only available as a post-build action, so I'm not
sure if the files will be available to send them as attachments.
Nevertheless it might still be cleaner than using ssh.

It shouldn't be a big deal to change the plugin so that "copy back to master" is available as a normal
build step.

HTH,

Fred

Ligade, Shailesh [USA]

unread,
Jul 6, 2012, 11:29:41 AM7/6/12
to jenkins...@googlegroups.com
Thanks Fred,

I guess this would have worked..but I am not deploying to slave..it is totally different VM, where I run bash script via SSH copy plugin..

All I need is copy few log files back to master Jenkins, if my script determines that deployment was failure, and attach the files to email.

Thanks

S

-----Original Message-----
From: jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] On Behalf Of Fred G
Sent: Friday, July 06, 2012 9:23 AM
To: jenkins...@googlegroups.com
Subject: [External] Re: Jenkins ssh and pull (copy) files

View this message in context: http://jenkins.361315.n4.nabble.com/Jenkins-ssh-and-pull-copy-files-tp4633889.html <http://jenkins.361315.n4.nabble.com/Jenkins-ssh-and-pull-copy-files-tp4633889.html>

Fred G

unread,
Jul 6, 2012, 2:48:00 PM7/6/12
to jenkins...@googlegroups.com
Oh, ok.
I guess you have a good reason why you are not running a Jenkins slave on this remote machine?

It saves a lot of file copying trouble. ;)
Reply all
Reply to author
Forward
0 new messages