Issue
-
A user with System.READ is able to see all Jenkins agents even though they cannot see any jobs.
-
I would like to prevent users from seeing the details of agents connected to Jenkins unless I explicitly grant them such a permission.
Resolution
To restrict viewing of agents, two features of Jenkins are required:
-
Custom view with
Filter build queueandFilter build executorsenabled -
Restrict jobs to agent
-
Create a new
list viewby clicking the+icon next to the currentAllview on the main Jenkins homepage.
-
-
Enable the options
Filter build queueandFilter build executors. These options will allow the build queue and build executors to show only those that are related to the jobs selected.Select the jobs that are to be shown by this view. Note, if this view is to replace the current
Allview, select all jobs or use an appropriate regular expressions to select all jobs. You may further restrict users based onrole permissionsoruser permissions.
-
Configure jobs to be restricted on particular agents to have the view filter on only these agents.
-
Comparing this with the original
Allview above, you will see only one executor present.
-
Lastly, to remove the previous default
Allview, go toJenkins>Manage Jenkins>Configure System>Default Viewand select your new filtered view. This option is only available when there are more than onelist viewavailable. Once you have selected the new default view, you may go back to the oldAllview andDelete view.