Is there a easy way to get a list of all node labels in Jenkins?
I can see which labels are set on each node (.../computer/) and which nodes have the same label (.../label/). But similar to listing all nodes on .../computer/ there is no listing of all the labels on .../label/
The approach with python and jenkinsapi or similar seem a bit too advanced for a listing that probably already is available in Jenkins (but not visible?)
I use the Scriptler plugin with the "show labels overview" script that is available from the remote script catalogue. This draws an ascii art table of all nodes versus all labels and makes it easy to see at a glance all the labels that are defined and what nodes use them. Show activity on this post.
When creating a new slave node, Jenkins allows us to tag a slave node with a label. Labels represent a way of naming one or more slaves. We leverage this labeling system to tie the execution of a job directly to one or more slave nodes.
Click on Manage Jenkins in the left corner on the Jenkins dashboard. Click on Manage Nodes.
The simple answer is, Agent is for declarative pipelines and node is for scripted pipelines. In declarative pipelines the agent directive is used for specifying which agent/slave the job/task is to be executed on.
Haven't installed/tried it myself, but the "label linked jobs" jenkins plugin has a label dashboard as one of its features.. it sounds like this is what you're looking for
Just came across this question. Since I did not want to install a new plugin I tried to achieve the same using the script console.
You even have to possibility to filter-out labels. The following example will filter-out any node name from the list - which is considered a label, too, but probably not relevant to most users:
def allLabels = [] Jenkins.instance.nodes.each { node -> node.assignedLabels.each { label -> if (label as String != node.name) { allLabels += label } } } println allLabels.unique().join('\n')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With