In this lesson, we explore the Jenkins Job Restrictions plugin, a powerful tool for enhancing your security and streamlining job execution. With this plugin, you can restrict job execution to specific nodes, enforce naming conventions, and even block triggers based on particular user IDs.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
Installing the Plugin
To install the Job Restrictions plugin:- Navigate to Manage Jenkins.
- Click on Manage Plugins.
- Find and install the Job Restrictions plugin.
- Restart Jenkins after the installation is complete.

Configuring Job Restrictions on a Node
After installing the plugin, you can apply restrictions to your Jenkins nodes. Follow these steps to configure a restriction on a node:- Go to Nodes.
- Select Built-In Nodes (or choose the specific node to configure).
- Click Configure.
- Enable the “Restrict job executions at node” option.
You can combine conditions using AND, OR, or NOT operators for finer control. For instance, you might require that a job name follows a certain pattern or is triggered by a specific user.


Testing the Restriction
Once configured, return to the Jenkins dashboard to test the plugin by triggering one of your projects. For example, try building the “NPM version test” job with the following steps:- Click Build Now on the job.
- Refresh the dashboard.

Creating a Job That Meets the Restriction
Next, create a new freestyle job that complies with the defined restrictions:- Name the job
Dasher_test_job. - Add a simple build step that executes a command like
echo "hello".

| Condition Type | Example | Description |
|---|---|---|
| Job Name Restriction | Regular Expression: Dasher_.* | Ensures job names start with “Dasher_“ |
| User ID Restriction (Optional) | Specific User: “Emma” | Only allows jobs triggered by “Emma” to run on the node |


The Job Restrictions plugin empowers you to enforce stringent execution conditions, allowing only jobs that meet specific criteria to run on designated nodes. This enhances both workflow control and overall security in your Jenkins setup.