2
votes

I have a Jenkins installation uses SWARM to connect new slaves. I bring up new instances in AWS and they use the SWARM Client to connect to the Jenkins master and register themselves as slaves.

Is it possible to have the Jenkins Master detect when a new slave is added and start to run some "init" job on that slave?

Thanks

2

2 Answers

4
votes

We use the Slave Setup Plugin to mount a network drive and copy some files from the master whenever a slave connects.

If you want to run certain Jenkins jobs whenever a slave (or certain slave) connects, you could try the Startup Trigger Plugin.

1
votes

There is the EC2 plugin which will spin up slaves on your behalf and run an init script on them for you.

Init script is the shell script to be run on the newly launched EC2 instance, before Jenkins starts launching a slave agent. If the AMI doesn't have Java pre-installed, you can do this in the init script. This is also a good place to install additional packages that you need for your builds and tests. The init script is located at /tmp/init.sh and is owned and run by the user account specified in the "Remote User" field (so use of "sudo" may be required for non-root accounts).