What is the meaning of "Projects tied to {node}" in Jenkins? - jenkins

I created a Jenkins node / agent / slave and use it for a pipeline. On the node's page there is a list "Projects tied to mynode". What does this mean? When is a project "tied" to a node?
Btw.: If "tied to a project" means here, that the node is used in a project, so why is this list empty?

"Projects tired to ...." will list Freestyle jenkins job which restrict the job executed on this node by specify the node label in job's configuration field:
Restrict where this project can be run -> Label Expression
After you run the job, your job will appear in the "Projects tired to ...." list
I think this list purpose is to let user know the impacted jobs when the node down or before restart or repair the node.
FYI, if the node label filled in Label Expression serviced by more than one machine, the job won't appear in that list. Because job can be executed on any one machine in that group.

Related

How to check if Jenkins node1 is free for the job, if not check for the node 2 and trigger the build on node2?

I have a job which has the node name as a parameter(Made possible using NodeLabel Parameter Plugin).
I will trigger the job always with node1 as the parameter. I want the job to see node 1 is online and free(no other builds are going on in that node). If node1 is free run this job on node1 else this job should find a free node and run it on that(ie; trigger this same job in other node (eg; node2) if node1 is not free).
How can I do that? How can I know whether a node is free? I don't want my job to be waiting for a node to complete other builds.
Have the same label name on both agents (for example "windows") and have your job run with label "windows". It will run in a little different manner. In this case when you run that job with target label "windows", jenkins will send the request to both nodes but jenkins will run the job on the agent which will respond first.

Jenkinsfile - Build Agents questions

I have following questions about Jenkins build agents:
Question 1: agent any means that "Execute the Pipeline, or stage, on any available agent" - how to check what are list of available agents and what are their capabilities (e.g. one agent can build maven, another not...)?
Question 2: agent { label 'docker' } means that I will use agent called "docker" - how to find out is that agent actually exists? Where to find it?
Thanks for help :)
Jenkins allows you to have multiple agents (nodes or slaves) but when you install jenkins the only agent configured is the master.
It is quite simple to configure new nodes, please refer to one of these guides:
https://wiki.jenkins.io/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines+on+Windows
https://www.packtpub.com/mapt/book/application_development/9781783553471/7/ch07lvl1sec47/managing-jenkins-master-and-slave-nodes
http://www.donaldsimpson.co.uk/2011/10/06/jenkins-slave-nodes/
When you are setting up a new node you can assign labels to it so that you can then use to perform specific tasks on that node from a pipeline, for example.
So answering your questions:
This setting can be done using labels.
Example:
All nodes with maven have a label, eg "maven".
Then running something like agent { label 'maven' } will only execute in one of this nodes.
You can list all available nodes and check the configurations for each one in Manage Jenkins > Manage Nodes.

Jenkins Multiple Slave node configuration

Our requirement is to we have two slave nodes and one jenkins job. Based on a parameter we must be able to decide where the job has to be run on node1 or node 2. Is there any plugin available?
i did by using build param. From add parameter add 'Node' then set the name of the parameter and other setting. you you have to setup Node[Build machine]. for your information.i added a picture.

How to execute single Jenkins job on multiple platforms with different parameters?

I have created one build job in Jenkins. I want to use that same job to run on multiple nodes but with different job parameter.
You can use https://wiki.jenkins-ci.org/display/JENKINS/Multijob+Plugin
Create a new multyjob job, in the build section create a Multijob phase, and trigger your job with "Pre defined parameters" and "Node label parameter" to specify the node to run on, and the values of the parameters you want to trigger your job with.
Good luck!

Query on triggering build remotely on mutliple conguration project

I have a job which executes on 10 platforms (slaves) but when I trigger the job and see its console output, I see a log message saying,
"Started by user <user>
Building remotely on <slave> in workspace: <path>"
Triggering slave1
Triggering slave2
Triggering slave3
Triggering slave4
Triggering slave5
.
.
.
Triggering slave10
The slave in the above messages is any one of the machines from these 10 slaves and sometimes it is any other slave which is not related to this job. How is the mechanism in Jenkins by which a slave is selected to trigger build on all target slaves?
Jenkins will look for any available slave and will assign a build to run on that slave. However, if you want to restrict the build on any particular slave, then you will have to perform the following steps:
Assign label to your slave nodes: To do that, go to Jenkins > Manage Jenkins > Manage Nodes > Select a Slave node > Configure. In this page, you will find a text box called Name. Assign a label/name to it. Perform this activity for all the nodes.
Tie job/project to a particular node(s): Now you have to go to your job's/project's Configure section. Look for the check-box named Restrict where this project can be run. Enable it. As soon as you will enable the check-box, you will see a text box named Label Expression. Assign the name of the node where you want this particular job/project to run. This setting will tie the job to that node and the build will always run on that particular node. Don't forget to click on the '?' mark icon on the extreme left hand side of this option for more details on how you can tie your jobs/projects to multiple nodes etc.

Resources