How to restrict job types in folders?

Article ID:115001750872
1 minute readKnowledge base

Issue

Administrators need to control which types of job that can be created in a folder. The goal is to restrict the types of job available in a folder and its sub-folders.

Environment

  • CloudBees Jenkins Enterprise - Managed controller (CJEMM)

  • CloudBees Jenkins Enterprise - Operations Center (CJEOC)

  • CloudBees Jenkins Platform - Client controller (CJPCM)

  • CloudBees Jenkins Platform - Operations Center (CJPOC)

  • CloudBees Folder plugin

  • CloudBees Folder Plus plugin

  • CloudBees Templates plugin

  • CloudBees RBAC plugin

Resolution

Let’s make available the Pipeline job type only.

  1. Create a new Folder (let’s call it FolderSample)

    1. Enable the Restrict the kind of children in this folder property

    2. Select the Pipeline type only
      Restrict Children In Folder Property

    3. Save

  2. Create a new Folder Template at root level (let’s call it TeamFolder) Folder Template creation

    1. Add as description; for example: Create a Folder with restricted job types list

    2. Configure it with your specific needs

    3. Save

  3. Go back to the FolderSample configuration

    1. Select the new TeamFolder type as well as Pipeline in Restrict the kind of children in this folder section
      Add TeamFolder In Restrict Job Types List

    2. Save

  4. Go back to the TeamFolder configuration

    1. From Transformer section, fill the Load Prototype Job field with FolderSample and click on Load

    2. Save

You are now able to create a Folder based on this new template. TeamFolder creation Let’s call it TeamARootFolder. TeamARootFolder creation
From this folder, when you click on New Item, the available types are Pipeline and TeamFolder only. Available Types For all sub-folders, these two types will be the only ones available.

Of course, you are available to define the Group(s) that is(are) allowed to access these folders.