Creating Users And Assigning Roles In Jenkins

Learn how to creating users and assign them permissions with the use of roles.

Creating Users And Assigning Roles In Jenkins

Contents


  1. Creating A User
  2. Creating A Role
  3. Deleting Objects
  4. Assigning Users To A Role
  5. Global Roles

Creating A User


Location: Manage Jenkins -> Manage Users -> Create User

Creating A User

Once you've filled in the details, click Create User button.

New User Entry

You have successfully created a new user!

The problem is they are unable to do anything except login. This is because they have not been given permission to do anything else.

This is where the idea of roles come in. A role is simply a set of permissions, which you can assign users onto. This is done to avoid redundancy.

Role Examples

If you have a group of people that all require the same permissions, instead of assigning the same set of permissions to them individually - which is incredibly time consuming - you can create a role with a set of permission and simply assign a user, or group of users, to that role. Now this group of users will have the exact same permissions.

If you have a team of testers, simply assign them the tester role, and vice versa.

Creating A Role


Location: Manage Jenkins-> Manage and Assign Roles -> Manage Roles

Item Roles

Steps

  1. Add name of Role in Role to add.
  2. Add a Pattern
  3. Click the 'Add' button to add the new role.
  4. The role will appear in the table above, now it is a matter of ticking boxes to set the desired permissions.

Pattern

Pattern is simply a regex that identifies all the folders/jobs that are influenced by the role.

In the screenshot above, we want to add a Tester role that can influence all the jobs with 'test' in the name.

test.* means "look for test and anything that comes after it except a newline"

^development.* means "look for development at the beginning of the line and anything that comes after it except a newline"

Deleting Objects


All tables have these red cross buttons on either side of each row.

Press these if you want to delete that row from the table.

Note: You cannot delete a role if users are assigned to them. Refer to the next section for assigning users.

Delete Roles

Assigning Users To A Role


Location: Manage Jenkins-> Manage and Assign Roles -> Assign Roles

On this page, scroll down until you see the item roles table. As you can see, the roles that we created are now the headers of the table.

Item role headers

Underneath this table you should see this text box.

Add new user or group

Put the username in this box and click add. This will added them to the item roles table and then you simply click the corresponding checkbox to give them their respective permissions.

Unchecking the box will unassign them.

Global Roles


Location : Manage Jenkins-> Manage and Assign Roles -> Assign Roles

The final step is to give them a global role.

Adding users to this table is similar to the item roles table. Just enter the user into the box directly underneath and click add.

Global Roles

Global roles override anything you specify in the Item Roles.

That is, when you give a role the right admin in the Global Roles, then this role is gives the user/group all permission, regardless of what you specify in the Item Roles.

For more articles checkout DevOps or Linux Tutorials