Search code examples
shelljenkinsjobs

Jenkins - Create a job which triggers a various number of parallels scripts


We have a Jenkins job which has a directory as parameter. Depending on the number of files in the directory, it executes a shell script several times.

We want these script executions to be parallels instead of sequentials. How can we do it?

Example: if there is 6 files in the directory, the script should be executed 5 times. If there is 15 files, the script should be executed 10 times.


Solution

  • You can use the parallel step of Jenkins Pipeline plugin (formerly known as Workflow plugin) to execute tasks in parallel. Please refer to the tutorial and this blog article on jenkins.io for more information. Hope this helps!