How to execute the same build again and again in Jenkins(Say I want to execute the build for 10 times continuously). After each execution the reports have to copied.
Don't say create 10 jobs and make use of Downstream/Upstream.
How to execute the same build again and again in Jenkins(Say I want to execute the build for 10 times continuously). After each execution the reports have to copied.
Don't say create 10 jobs and make use of Downstream/Upstream.
It is possible to launch jobs via script. Create a wrapper job which will invoke the given job.
This is how you launch a job via command line (I use Windows)
java -jar <Jenkins Install folder>\war\WEB-INF\jenkins-cli.jar -s http://JenkinsServer:8888/ build DEMO -s --username ChuckNorris --password HellYeah
There are variations where you need not put username and password. Google is your friend.
So i will write a wrapper job which will call this job. I will use "Execute Windows Batch Command" as the build step and then write a simple loop in which it will invoke the job 10 times.
NOTE: The -s after the invoked job name. That makes the master wait for the job to complete before launching the next iteration of the same job. You might want to keep this unless 10 same jobs simultaneously running is fine with you.
You can use the method given from NotAgain, or a curl request like this.
If you don't want to create a wrapper, you can add to your jenkins installation the Throttle concurrent builds plugin, because you may want that your job has exclusive access to its workspace (depending on what you do, it could fail or not).
Finally the last possibility is to create another job, and add as a post-build action the option to build other jobs, as many time as you want (yes it's weird but it can works, according to what you need to do).
We do this with this Plugin: https://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugin
With this plugin "Build Flow Plugin" you can create a new job type in Jenkins called "Build Flow" which allows you to control a build pipeline aka flow by groovy script:
This will run the Jenkins Job "Your Jenkins Job" 30 times.