Reputation: 783
How can I achieve parallelism in Jenkins?
I am using Jenkins to run shell scripts using "execute shell script on remote host using ssh". I want to run multiple shell scripts on parallel, how do I achieve it?
I have set up "SSH site" keys and able to communicate with remote server.
Thank you.
Upvotes: 1
Views: 5134
Reputation: 66
If you are connecting to multiple hosts to run the same tasks, then Ansible is a good solution. Ansible will run the same script on each host in parallel. I've noticed it results in significantly less SSH disconnects as well, an issue I was having frequently using ssh commands inside Execute Shell. You can run Ansible from within a Jenkins job pretty easily.
Upvotes: 0
Reputation: 14009
Within a single job, use the Execute Shell Script feature and background all your scripts.
myscript1.sh &
myscript2.sh &
For multiple jobs, they will run in parallel by default, if you have multiple runners on your node, or multiple nodes associated with your server. Add more runners by configuring the node; click on it on the left side of the screen, and then click the Manage Node link.
Upvotes: 2