How to restrict job types in folders?

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 Master (CJEMM)
  • CloudBees Jenkins Enterprise - Operations Center (CJEOC)
  • CloudBees Jenkins Platform - Client Master (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)
    a. Enable the Restrict the kind of children in this folder property
    b. Select the Pipeline type only
    Restrict Children In Folder Property
    c. Save
  2. Create a new Folder Template at root level (let’s call it TeamFolder)
    Folder Template creation
    a. Add as description; for example: Create a Folder with restricted job types list
    b. Configure it with your specific needs
    c. Save
  3. Go back to the FolderSample configuration
    a. 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
    b. Save
  4. Go back to the TeamFolder configuration
    a. From Transformer section, fill the Load Prototype Job field with
    FolderSample and click on Load
    Transformer
    b. 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.

References

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.