0

I need to trigger all the jobs in a specific view programmatically and connect it to a Spring Boot controller class. The jobs are in my local Jenkins.

I read the links, but it can only trigger one job at a time. I have like 50 jobs in my Jenkins. how do I trigger all at once.

I cannot edit all the jobs from the job config and then execute it, so I need another way, maybe from Jenkins CLI, but I don't know how to do that.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Bhavya
  • 109
  • 2
  • 6
  • Does this answer your question? [Jenkins/Hudson - How to run multiple jobs in parallel more than 1 level deep?](https://stackoverflow.com/questions/13366167/jenkins-hudson-how-to-run-multiple-jobs-in-parallel-more-than-1-level-deep) – Aniket Sahrawat Feb 11 '21 at 17:06

2 Answers2

0

You can use groovy and scheduleBuild2. This to trigger the build - waitPeriod 0

This should work...

Jenkins.instance.getView('<VIEW>').items.each() {
    it.scheduleBuild2(0)
}
Ian W
  • 4,559
  • 2
  • 18
  • 37
0

We can trigger jobs programmatically by using a command: java -jar jenkins-cli.jar -s http://localhost:8082/ -auth : build

Bhavya
  • 109
  • 2
  • 6