Can I tie 2 agents at once? - jenkins

I am trying to make 2 Jenkins agents do the same job at the same time.
2 agent's label is same:'rs'.
Project setting is "Restrict where this project can be run" selected Label Expression 'rs'.
When I click build now button, only one of the agents is working.
Is this normal? Is there a way to distribute one job to multiple agents at one click?
Thanks for your help.

Related

Jenkins, assigning jobs between nodes

I have Jenkins set up with 3 nodes (build-01, build-02 and build-03), labeled with the "build" label , and a Freestyle-type project configuration, in which "Restrict where this project can be run" is set to "build".
When I start a project, it runs OK on build-01, however, when I start another project (with different parameters), it is queued by Jenkins to the same node, even if two other nodes are idle.
How could I configure Jenkins to assign a project to a next idle node?
Thanks!
Do you have labels on those nodes? Typically you'd see labels being utilized for this situation and Jenkins would schedule based on available nodes.

Agents not picking new build requests in TFS 2017

I have 10 build agents configured in two servers under one agent pool. Whenever the first four agents are used, the build requested is in the queue on the first four agents, but there are another six agents which are available and the builds are not queued to those agents.
It's been almost six months and agent 10 has not even once handled a build. Other agents from 5 to 10 are hardly used. Why is there this phenomenon? How can we handle this by using all the agents fairly?
TFS will auto select the available build agent in the pool when running the build. It's more like a conditional random choice. It's not able to prioritize the build agent for now. There has also been a related uservoice as below:
TFS 2015 build vNext agent prioritization
As a workaround you could specify a build agent in vNext build.
You can add a User Capability to that specific build agent. Then in the build definition you just need put in that capability as a demand (General tab).
It seems like the builds are queued on the 'oldest' agents first. So if agent 10 is the last agent you created, it will only be used if the first 9 are in use, assuming they all have the same capabilities.
It does not appear to be a random selection of agents, but based on the order of creation of agents. Ironically that means that if you add a new powerful build server, those agents will be at the bottom of the queue.
The user voice suggestion in PatrickLu-MSFT's answer is to allow the agent to be prioritized.
The workaround at this moment seems to be to remove all (or some) agents and re-create them in the order you want them to be used. Which still means the last agent will be used less, but at least you can influence the distribution of the agents a bit.
We are running into this issue as well. We have six build servers with three agents each and builds are not distributed fairly. I also do not want to assign an agent per definition, but I guess we are going to have to puzzle with it.

jenkins to get build number from 2 different jobs

Right now I use "Run" parameter in a job that retrieves last successful build of another job to this job. This parameter gives me a dropdown of all last successful builds and I can manually choose any build and use it in my current job. But now I want to extend it to choose last successful build from 2 different jobs i.e. my current job should be able to see all successful builds in 2 different jobs and be able to choose any job of the choice. How do i do this in Jenkins. (Note: I do not want 2 different Run parameters- one for each job. It should be a single choice)

Jenkins blocking/throttling build flows using build-flow-plugin

I have a build flow that runs multiple build flows
Main Flow
parallel (
{ build("flow1") },
{ build("flow2") },
{ build("flow3") },
{ build("flow4") }
)
Each sub flow runs a set of jobs
Sub-flow
build(job1)
build(job2)
Each of the jobs are configured to run on a Jenkins slave with a certain label but I am unable to figure out how to get each job to run on a slave that doesn't have a flow already on it.
ie. both flow 1 and flow 2 queue on the same slave when I have 2 slaves available with the defined label.
Anyone able to help me with configuring blocking/throttling for build flows.
I think the problem lies with the fact they don't take up an executor on the slave.
Thanks
Typically jobs build on the last node they built on. So, I'm assuming both the flyweight jobs last ran on the same slave?
Here are some ways to make one of the flyweights move to another slave.
Take one of the slaves offline and kick off flow1. Then switch places and take the other offline and start up the remaining. Kick off flow 2. This should put the last place where each flyweight built on different slaves.
Add a different label to each slave and target each one separately. For example, Flow1 targets Node1 and Flow2 targets Node2. Each flyweight should only go to that label being targeted.
Install the Job Restrictions Plugin and create some kind of complex logic to determine whether the flyweight should build on the node.

deploy server selection in Jenkins

Is there any plug-in or configuration that I add to jenkins server and make me able to select my favorite destination server for deployment ?
I could add configuration to jenkins which makes me able to select "the branch" that I want to build. with a cascade menu . I want some thing the same , for destination server.
There is an option called "Restrict where this project can be run" where you can specify which servers the job should be run. For that you have to label your servers. You can do that under Manage nodes section of Jenkins.
To make the choice at run time, you can launch the jobs via Jenkins cli and populate the Label parameter with desired value. I am looking for the site where I picked up this info but have not been able to find it till now.
Check if these two sites help:
http://michael-prokop.at/blog/2014/03/01/jenkins-on-demand-slave-selection-through-labels/
https://developer.cloudbees.com/bin/view/DEV/On-Premise+Executors
I found the solution. It is actually combination of this two articles :
first step-> https://wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines
Second-> https://wiki.jenkins-ci.org/display/JENKINS/NodeLabel+Parameter+Plugin
if you follow this two articles. you would have a selective menu when you want to build the software. You can select your destination server to build.
Thanks all of you for your hints.

Resources