Skip to content

Instantly share code, notes, and snippets.

@vadikgo
Created July 17, 2020 07:26
Show Gist options
  • Save vadikgo/eab7a35a9841f02aa8f5eedbd283c478 to your computer and use it in GitHub Desktop.
Save vadikgo/eab7a35a9841f02aa8f5eedbd283c478 to your computer and use it in GitHub Desktop.
List Jenkins nodes with labels
def hostNames(label) {
def nodes = []
Jenkins.instance.computers.each { c ->
if (c.node.labelString.contains(label)) {
nodes.add(c.node.selfLabel.name)
}
}
return nodes
}
hostNames('masterLin')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment