New plugin

43 views
Skip to first unread message

DuMaM

unread,
Mar 22, 2024, 6:12:14 AM3/22/24
to Jenkins Developers
Hi,

I'm looking for some answers to questions which pop out during plugin development.
https://github.com/DuMaM/lock-project-plugin

My work environment requires from me to give users privileges to create new jobs, but I need to lock creation of non pipeline jobs.
I could take a solution proposed a long time ago by Daniel Beck, but I fought that maybe it's a good place for a more universal plugin for that purpose, so I tweaked his code a bit.

Now i have a functional plugin which can block creation of any job type. It still requires some work but i kind of suck on one issue.

I don't understand why it always requires a restart to apply changes from system config.
Could somebody step in and help me here?

I'm also seeking information about:
* ways of testing Jenkins plugins — I wasn't able to find a detailed documentation
* process how i can introduce it to jenkinsci org

Thanks

Winter, Markus

unread,
Mar 22, 2024, 6:42:50 AM3/22/24
to jenkin...@googlegroups.com

Your problem with the restart is because you configure it in the constructor. But this is an Extension which is only created once at startup and not every time a check is performed.

So you will need to fill the projectTypes list in the filter method (and don’t make it a class field).

You might also consider of storing the list in LockProject class (as transient field) and just use it in the filter. In LockProject you need a to fill the list in the configure method and you need to ensure it is filled when loaded (overwrite load method probably).

 

 

From: jenkin...@googlegroups.com <jenkin...@googlegroups.com> On Behalf Of DuMaM
Sent: Freitag, 22. März 2024 11:12
To: Jenkins Developers <jenkin...@googlegroups.com>
Subject: New plugin

 

You don't often get email from nowak.b...@gmail.com. Learn why this is important

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/61bdadc2-c276-4a72-a0a0-d4017bbdc023n%40googlegroups.com.

Daniel Beck

unread,
Mar 22, 2024, 6:53:49 AM3/22/24
to jenkin...@googlegroups.com
On Fri, Mar 22, 2024 at 11:12 AM DuMaM <nowak.b...@gmail.com> wrote:
My work environment requires from me to give users privileges to create new jobs, but I need to lock creation of non pipeline jobs.
I could take a solution proposed a long time ago by Daniel Beck, but I fought that maybe it's a good place for a more universal plugin for that purpose, so I tweaked his code a bit.

Please note that this doesn't actually do what you seem to claim it does. It _hides_ the job type from the job creation form, but CLI, remote API, etc. still allow job creation. See e.g. https://issues.jenkins.io/browse/JENKINS-52728?focusedId=344840&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-344840 in which I point out this limitation (and suggest ExtensionFilter as alternative). If I claimed somewhere that hide-maven actually prevents job creation, I apologize for the mistake.

DuMaM

unread,
Mar 22, 2024, 12:22:37 PM3/22/24
to Jenkins Developers
Thanks for all those suggestions. I will apply them and will return to you for further guidance.
Reply all
Reply to author
Forward
0 new messages