How do I get a Jenkins server to push bash code to a different server?

65 views
Skip to first unread message

Kiran

unread,
Jan 28, 2016, 8:33:27 PM1/28/16
to Jenkins Users

I have Jenkins installed on a Linux server. It can run builds on itself. I want to create either a Freestyle Project or an External Job that transfers a bash script and runs it on two separate linux servers. Where in the GUI do I configure the destination server when I create a build? I have added "nodes" in the GUI. I can see the free space of the servers in the Jenkins GUI, so I know the credentials work. But when I create a build, I see no field that would tell Jenkins to push the bash scripts and run them on certain servers.


Are Jenkins nodes just servers that lend computing power to the master server? Or are they the targets of Jenkins builds? I believe that Jenkins "slaves" provide computing power to the Jenkins master server.


Normally Jenkins is used to integrate code. What do you call the servers that Jenkins pushes code into? They would be called Chef clients or Puppet agents if I was using Chef or Puppet for integrating code. I've been doing my own research, but I don't seem to know the specific vocabulary.

Message has been deleted

Michael Neale

unread,
Jan 29, 2016, 2:51:20 AM1/29/16
to Jenkins Users
Hi Kiran. 

Often people do the builds on the master - that is surprisingly common. 

However the power comes with distributed builds: https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds  and slaves. that is where the work ideally happens. 

In terms of "pushing code into" I would call those deployment targets - and there are many many many many plugins that will support deploying to many many places via many many tools (usually that happens from a slave node too, but not always). 

hope that helps. 

Kiran

unread,
Feb 1, 2016, 7:28:13 AM2/1/16
to Jenkins Users
If I have a single job that I want to run on many computers, that is a multi-configuration job? 
Message has been deleted

Kiran

unread,
Feb 1, 2016, 9:43:21 PM2/1/16
to Jenkins Users
If the job just deploys a file to different servers (and uses no slaves) is a Freestyle project?

On Monday, February 1, 2016 at 8:53:50 AM UTC-5, Mark Waite wrote:
Yes, a project that runs a job on multiple slaves is a multi-configuration (or "matrix") project.

http://stackoverflow.com/questions/7515730/jenkins-and-multi-configuration-matrix-jobs gives a good description of the differences between the two.


Mark Waite

On Mon, Feb 1, 2016 at 5:28 AM Kiran  wrote:
If I have a single job that I want to run on many computers, that is a multi-configuration job? 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/24c25552-d279-4138-8984-b6003015871f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Maciej Jaros

unread,
Feb 4, 2016, 6:14:32 AM2/4/16
to jenkins...@googlegroups.com
Kiran (2016-02-02 03:43):
If the job just deploys a file to different servers (and uses no slaves) is a Freestyle project?


You can use a freestyle project to either and Publish Over SSH plugin to simply push files to other computers.

If you have many deploy servers you can configure a password-less SSH connection (certificate without password) and then in a Execute shell step do something like:
serverList=(app001 app002 app003 app004 app005 app006 app007 app008)
for appServer in ${serverList[@]}
do
    connectionString="root@$appServer"
    scp ./some-folder-in-jenkins-job-workspace/* $connectionString:/destination/folder/
done


Some more information on how to setup SSH connection:
https://www.digitalocean.com/community/tutorials/ssh-essentials-working-with-ssh-servers-clients-and-keys

Basicly there are 3 steps:

1. Generate password-less certificate (on Jenkins machine):
ssh-keygen -b 4096

2. Copy client cert to remote machine (login is required 1st time):
ssh-copy-id root@app001

3. Check connection:
ssh root@app001


Regards,
Nux.
Reply all
Reply to author
Forward
0 new messages