By default, Jenkins comes with very basic user creation options. You can create multiple users but can only assign the same global roles and privileges to them. This not ideal, especially for a large organization. The Role Strategy Plugin enable you to assign different roles and privileges to different users. You will first need to install the plugin in your Jenkins mange environment. In this Jenkins tutorial, you will learn

How to Create a User in Jenkins How to Install Role Strategy Plugin in Jenkins How to Manage Users and Roles in Jenkins How to Assign Roles in Jenkins How to Create Project Roles in Jenkins

How to Create/Add a User in Jenkins

Below are the steps to create new user in Jenkins: Step 1) Login to Jenkins Dashboard Login to your Jenkins dashboard by visiting http://localhost:8080/ If you haven’t installed Jenkins in your local server, go to the appropriate URL and access your dashboard by using your login credentials.

Step 2) Choose the option You will now see options to create and add user in Jenkins and manage current users. Step 3) Create a new User

Under Manage Jenkins, Click Create User Enter Jenkins add user details like password, name, email etc. Click Create User

Step 4) User is created You will see on the dashboard that a new Jenkins create user as per the details entered.

How to Install Role Strategy Plugin in Jenkins

There are two methods for installing plugins in Jenkins:

Installing it through your Jenkins dashboard Downloading the plugin from Jenkins website and installing it manually.

Step 1)

  1. Go to Manage Jenkins
  2. Click on the Manage Plugins option

Step 2)

In available section, screen Search for “role”. Select Role-based Authorization Strategy plugin Click on “Install without restart” (make sure you have an active internet connection)

Step 3) Once the plugin is installed, a “success” status will be displayed.

Click on Go back to the top page. Step 4) Go to Manage Jenkins -> Configure Global Security -> Under Authorization, select Role Based Strategy. Click on Save.

How to Manage Users and Roles in Jenkins

Following are the steps on how to manage and assign roles in Jenkins: Step 1)

  1. Go to Manage Jenkins
  2. Select Manage and Assign Roles

Note: that the Manage and Assign Roles option will only be visible if you’ve installed the role strategy plugin.
Step 2) Click on Manage Roles to add new roles based on your organization.

Step 3) To create a new role called “developer”,

Type “developer” under “role”. Click on “Add” to create a new role. Now, select the Jenkins user permissions you want to assign to the “Developer” role. Click Save

How to Assign Roles in Jenkins

Step 1) Now that you have created roles, let us assign them to specific users.

Go to Manage Jenkins Select Manage and Assign Roles

Step 2) We shall add the new role “developer” to user “guru99”

Selector developer role checkbox Click Save

You can assign any role to any user, as per your need.

How to Create Project Roles in Jenkins

You can create project specific roles under Project Roles. Step 1) In Jenkin’s Manage and Assign Roles

Enter a role as “tester” Add a pattern to this by adding tester.*, so that any username starting with “tester” will be assigned the project role you specify. Click Add Select privileges Click Save