Issue
When a job is building in Jenkins, how can I check if "Restrict where this project can be run" is checked or not without installing any plugin.
I thought it would show in environment variables but i didn't see it.
Solution
Jenkins uses assignedNode property for restricting the project to label/node. You can get this property using
- /config.xml - Look for assignedNode property
Using groovy (run this from master console)
def job = Jenkins.instance.getItemByFullName('')
println job.getAssignedLabel().getExpression()
For more information, check - getAssignedLabel
Hope this helps
Answered By - Vijay