0

I am new in Jenkins and looking for an easy solution:

I have about 10 jobs and about 4 nodes and would like to run all the jobs on different nodes. I want the jobs to run simultaneously, when a node is free then a job that didn't run yet should run on it.

What I did is that I gave a label to each node and on the jobs I set to run on label. I added a job X that not do anything, and in the jobs that I want to run I set to run after the job X finished. This solved the issue.

My problem now is I want to send report in mail after all the jobs are done but I dont have a way knowing when they are done. I tried using pipeline with stages, but even with pipeline it does only trigger the jobs but I cannot know when they are done. Any suggestions?

Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
  • See [this answer referring to the MultiJob Plugin](http://stackoverflow.com/a/35587259/1744774). Select _Job execution type_: `Running phase jobs in parallel` below the added jobs. Add an e-mail _**Post-build action**_ to your MultiJob project. – Gerold Broser Feb 26 '17 at 20:42

1 Answers1

0

You can use this plugin to do that. After you add that plugin to Jenkins just do a "New Item -> Multijob Project" from Jenkins home and configure the jobs to run parallel and then you can send mail using this plugin

  • Thanks for the answer, the multijob plugin is working fine, Now I am trying to send mail with result using the plugin email-ext plugin but I am not sure how to insert all the names of the jobs since in multijob it is running as one job that run all the jobs, so on fail it will send fail on the multijob name and not the name of the job that failed – Tal Ben Shaul Feb 28 '17 at 15:42
  • Check environment variables of that job, for reference check the below link I http://stackoverflow.com/questions/16061427/how-to-pass-a-build-number-within-the-multijob-plugin if not let me know. – Pradeep Thimmireddy Feb 28 '17 at 23:45
  • I tried adding to the mail: $_BUILD_NUMBER $_BUILD_RESULT when is the job name. It didnt work. I was expecting pass/fail on that job. I would like to send a table (I can create it in html) with the names of the jobs and the resuls. Can you help me ? – Tal Ben Shaul Mar 01 '17 at 14:28
  • I can help you, tell me that error you got when you used $_BUILD_NUMBER – Pradeep Thimmireddy Mar 01 '17 at 19:25
  • Also check the below location if you have $_BUILD_NUMBER available http:///job///injectedEnvVars/ – Pradeep Thimmireddy Mar 01 '17 at 19:27
  • I dont have job number. I am not getting error when running $_BUILD_RESULT, I am just getting the same string and not different value. I would like to get the name of the job and the result. I guess I need to add env. variables but not sure how it works with multijob....can you send me steps to do in order to get name and result from specific job in multijob ? – Tal Ben Shaul Mar 02 '17 at 06:44
  • You can see them here. are you able to open this http:///job///injected‌​EnvVars/ – Pradeep Thimmireddy Mar 02 '17 at 19:41
  • $ is not the name of the multi-job, it is the name/names of the individual job/jobs that you are running using multi-job – Pradeep Thimmireddy Mar 02 '17 at 19:43