Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins/Hudson - Run script on all slaves

I have a requirement to run a script on all available slave machines. Primarily this is so they get relevant windows hotfixes and new 3rd party tools before building.

The script I have can be run multiple times without undesirable side effects & is quite light weight, so I'm happy for this to be brute force if necessary.

Can anybody give suggestions as to how to ensure that a slave is 'up-to-date' before it works on a job?

I'm happy with solutions that are driven by a job on the master, or ones which can inject the task (automatically) before normal slave job processing.

like image 445
Ash Avatar asked Aug 19 '11 14:08

Ash


People also ask

How many slaves can Jenkins have?

1-200 is the range you can get to without having to *heavily* tune GC or change some Jenkins hidden properties.

How do I run a shell script in groovy?

To enter groovy shell you need to type groovysh in command line and hit enter. You can write any groovy expressions inside the groovy shell and run. Shell variables are all untyped. This behavior can be changed by activating interpreter mode.


2 Answers

My shop does this as part of the slave launch process. We have the slaves configured to launch via execution of a command on the master; this command runs a shell script that rsync's the latest tool files to the slave and then launches the slave process. When there is a tool update, all we need to do is to restart the slaves or the master.

However - we use Linux whereas it looks like you are on Windows, so I'm not sure what the equivalent solution would be for you.

like image 74
gareth_bowles Avatar answered Oct 19 '22 09:10

gareth_bowles


To your title: either use Parameter Plugin or use matrix configuration and list your nodes in it.

To your question about ensuring a slave is reliable, we mark it with a 'testbox' label and try out a variety of jobs on it. You could also have a job that is deployed to all of them and have the job take the machine offline it fails, I imagine.

Using Windows for slaves is very obnoxious for us too :(

like image 24
bnovc Avatar answered Oct 19 '22 09:10

bnovc