Jobs naming convention enforcer

1,365 views
Skip to first unread message

Daniel PETISME

unread,
Feb 23, 2012, 8:16:17 AM2/23/12
to jenkin...@googlegroups.com
Hi guys,

I want to know you have rules concerning the job's names?
I do and currently I don't have any tool to "force" the users to follow the conventions.
I've the maven-enforcer plugin in mind which check if you have specify the versions of all your dependencies for instance.

After a (very) quick research, I didn't see any Extension or equivalent which allows me to specify any regexp-based naming convention.
So, these modifications should be done in the core of Jenkins.

How do you handle this use case?

Thank you for your answers.

Cheers

Daniel

Jacob Robertson

unread,
Feb 23, 2012, 12:18:52 PM2/23/12
to jenkin...@googlegroups.com
I know this isn't really what you're asking for, but in my
organization we don't enforce any naming conventions, but the Jenkins
admin creates views for different offices and purposes, and uses
either the simple regex to include jobs, or the view-jobs-filter
plugin, and then if a job creator wants their job to show up in the
right view, they have to follow conventions. You can replace the
"All" view also, so if someone creates a job that doesn't follow
conventions, that job wouldn't show up in any view.

domi

unread,
Feb 23, 2012, 3:56:58 PM2/23/12
to jenkin...@googlegroups.com
I do have the same requirement too, just did not take time to take a closer look at it yet…
imod

Daniel PETISME

unread,
Feb 26, 2012, 5:07:13 PM2/26/12
to jenkin...@googlegroups.com

Hi guys,

thanks for your answers.

@Jacob I do the same trick, but it's not enought. I need to be more "strict"

@domi As a Quick and Dirty try, I've made a prototype. Have a look at the attachments.

In the Gobal config page, I can specify a regexp-based naming convention.

 Then when I try to create a new job, if it doesn't match the pattern an error message appears.

In practice, I've modified the Jenkins core and war. It bothers me to modified these core components... but I dont know how to make it in another way.

What do you thing about this Q&D solution?

I would appreciate more coments/opinions to open an Enhancement Request.

Cheers

Daniel

domi

unread,
Feb 27, 2012, 12:45:23 PM2/27/12
to jenkin...@googlegroups.com
Daniel,
this is pretty much what I would need, but I think that would not be flexible enough for other use cases…
I can think of possibilities where the job pattern has to match some security constraints and there like.
Therefore I suggest we should add an extensions point for this.
where are your sources? can you point me to your github repo? I i'll gone have a look and implement a
new extension point for the core then. wdyt?
regards Domi  

Daniel PETISME

unread,
Feb 28, 2012, 3:41:09 PM2/28/12
to jenkin...@googlegroups.com
Hi,

An ExtensionPoint is exactly what I had in mind too!

I would like to help on defining the Extension point design.

Do you think it's possible to disable the "Create" button if the job doesn't match the prerequisites?
This naming constraints should be applyed during renaming too?

This the repo https://github.com/danielpetisme/jenkins/tree/joba_name_enforcer
the modifided files are:
core:
      jenkins.model.Jenkins.java
      jenkins.model.Jenkins/configure.jelly
      jenkins.model/Messages.properties
war
   jobNamingConventionEnforcer.html


Cheers

Daniel

Daniel PETISME

unread,
Feb 29, 2012, 4:48:18 AM2/29/12
to jenkin...@googlegroups.com
I've created the following JIRA to gather the information
https://issues.jenkins-ci.org/browse/JENKINS-12928

Cheers

Daniel

lakshmi reddy

unread,
Jan 17, 2013, 8:25:48 AM1/17/13
to jenkin...@googlegroups.com
Hi Daniel,

I would like to implement the naming standards for our projects. Can you please provide me access to the github repo.

Can you also help me in step-by-step process to implement those?

Would really appreciate your kind help

Thanks,
B Lakshmireddy

teilo

unread,
Jan 17, 2013, 9:09:52 AM1/17/13
to jenkin...@googlegroups.com

The feature is implemented – you may want to look for “Restrict project naming” in your Jenkins (mange Jenkins – configure system).

Or is there something that you are missing in the current implementation?

Reply all
Reply to author
Forward
0 new messages