I have a very specific use case. All my Jenkins users must be allowed to create jobs that do a very specific thing. Not generic jobs. But jobs that are all created from the same template.
I use the Job DSL plugin to create these jobs, and the jobs created all use the same pipeline code.
Now, I'd like to remove the users' permission to create any other type of job except this one. So that when the user clicks "New Item" the Freestyle, Pipeline, Maven, etc options are hidden or disabled and only my new job type can be chosen.
What's the best way to go about this? My plan is as follows:
What's the appropriate extension point to define a new job type? Or what's a good plugin to look at to get an idea?
How do I disable or hide all other project types? I'm thinking I'll need to define my own Permissions.
How can I hook into my existing DSL job so that the creation of my job will fire the seeder I already have?
On Thu, Jan 11, 2018 at 6:02 AM, Miguelangel Fernandez
<[hidden email]> wrote:
> what's a
> good plugin to look at to get an idea?
For what it’s worth: the CloudBees Templates plugin, along with the
Folders Plus plugin, allows precisely your use case. (Templatized jobs
are not a new item type; rather, the template UI conceals the standard
creation and configuration options.)
Writing a similar feature from scratch would be, well, a lot of work.
Most admins would instead just use Job DSL and deny Job/Create and
Job/Configure to regular users, requiring all modifications to be done
as change requests to DSL sources.
Thank you for the advice, Jesse. The Templates Plugin is a feature of Cloudbees Jenkins, not a free open-source plugin. I don't have the budget for CloudBees Jenkins so I've started trying my hand at developing my own project type -which is the first of the items I've outlined above. Doing well so far -and having fun at it. I'd appreciate some pointers on implementing the other two:
Disable Freestyle, Folder and Pipeline jobs from the "New Item" view.
Great stuff guys. As Daniel and Jesse suggested I've extended DescriptorVisibilityFilter the same way the Hide Maven Plugin does. This is a great first step. Now I want to try Robert's idea to see whether I can make this a bit more granular and disable it only for certain user groups. I had no idea I could do stuff like this with Jenkins, so thank you all of the awesome advice.