run multi job of multi jobs on jenkins - jenkins

I want to build multiple jobs in jenkins:
I install multi job plugin on jenkins. When I build test_all_jobs, it run job1 and freeze on it and doesn't start job1-1 until I close job1 test!
Actually I want to start job1-1 then job 1-2 and after they finished job 2-1 then job2-2 should start.
I should say I can not use Build Flow Plugin.
Thanks.

I don't use the multi job plugin. Instead, I use the combination of the Conditional BuildStep Plugin and the Parameterized Trigger Plugin.
I think together, you get much more flexibility and ease of configuring your desired flow.
Look into these and see if you can get the answer you want from joining them.
I hope this helps.

I guess this issue is because of the number of executors assigned to the slave node on which you are running the job is assigned with 1.
Under nodes---->select your node ----> Configure ---> Increase the no of executors
Hopefully this helps you.

Related

How to run jenkins build alternatively on agent nodes?

Let's say I have a job A and also a agent configured. I want to run build 1 of Job A on master and build 2 of Job A on agent node.
Is there an option to achieve that ?
OR
Is there a way where my job looks at controller and if it already finds a build running, then start the next build on agent ?
Are you intending to run in parallel or just alternate? (Not a good idea to run jobs on master; could configure a node to run on same host as "master".). Seems to be parallel and you have restricted to one executor each on master and agent (you can have more, in which case any advice may be moot).
Nevertheless, Jenkins queue job allocation to executors is "sticky"; it tries to run where last run, unless unavailable. This can lead to overloading in nodes. So the M,A,M,A pattern is unnatural.
There are plugins that might help: Least Load, Scoring Load Balancer, but maybe not.
Perhaps an approach would be to restrict your job using a label and have a post-build groovy step that moves the label to the other upon success for the next run or two labels and the job self-modifies the label to match the other.

Execute Build Jobs/Pipelines not on Master but only on Build Agent

Following the Jenkins Best Practices, I want to avoid that Build Jobs/Pipelines could be executed into my Jenkins Master.
To do so, I've installed the Job Restrictions Plugin, using it to configure the Master to run only some Maintenance Pipelines.
The problem is that now Build Pipelines that are configured to run on specific Agents, are not executed anymore. I see that the Build Queue continuously grows, and the Pipelines are not runned. I think that this behaviour could be related to Flyweight Executors of the Master.
So, the question is the following: How can I execute on Master just a little subset of Maintenance Pipelines and, in the mean time, execute Build Pipelines only on specific Agent?
You can configure the master node to only be used when explicitly named. Just click the master node > go to configure and change Use this node as much as possible to Only build jobs with label expressions matching this node
I found the solution that perfectly fits with my needs, here.
To quickly sum up the solution, I was to able to exclude all the user Builds from Master and run on it only the Jobs/Pipelines of a specific Jenkins folder (IuA in my case), configuring the Job Restrictions Plugin in the following way:
In order to better understand the logic behind this solution, I recommend you to give a look at link that I posted above.

Running different jobs on different nodes in Jenkins in parallel

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?
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

Decentralised execution of jobs in jenkins

I came across multi job plugin which helps in executing jobs parallelly but I want to reduce the load on server.So I want to decentralised the execution of jobs.
Is it possible in jenkins to achieve this.If yes then how to achieve it.
Here you have a comprehensive description how setup distributed builds in Jenkins.
You can also try to create build pipelines.
Try Build Flow Plugin
You can run both sequential and parallel by using this plugin.

Jenkins Build Distribution among Slaves

I need to get some advice about the way to control the way Jenkins Slaves are used / Jobs are being triggered.
Background / Constraints:
I have a sequence of 10 jobs that run one after each other using the "Trigger parameterized build on other projects" option Parameterized Trigger Plugin.
Each Build of these jobs must run on the same node (I am doing it by using "Build on the same node" which is also configured in the parameterized build plugin and comes from the NodeLabel Plugin).
I have 5 Slaves (current number of executors per slave is 1 but i am open for suggestions here...)
Once Slave is occupied by a Build Sequence, no other job can run on it. When I had only 1 slave, the way I enforced it was using the "Block build when downstream project is building"
The way I configured the slave to be chosen when the first Job is triggered is one of the following: (None of them solved my problem)
a. Using the "Restrict where this project can be run" and put there a label that all relevant slaves will point to.
b. Using the option of "This build is parameterized" (Parameterized Trigger Plugin) and then add a "Node" parameter with the list of Slaves that the User can choose from.
What I want to achieve?
When a User triger the build of the First Job in the Build Sequence, this Build will be done on once of the idle Slaves. (I mean a slave that is doing nothing at the moment)
If there are no idle slaves, then it will join a queue of one of them (doesn't matter which)
Any suggestions how to solve it?
Thanks!
Try passing ${NODE_NAME} as a NodeLabel as a post-build trigger to the downstream jobs. If that works, you may need to pass it every job.
Try node-label parameter plugin. you can make Jobs to run slave node which is free at that movement

Resources