jenkinsci / nomad-plugin

Nomad cloud plugin for Jenkins
https://plugins.jenkins.io/nomad/
MIT License
56 stars 41 forks source link

feat: Add maximum jobs per template configuration #196

Open arsiesys opened 1 year ago

arsiesys commented 1 year ago

Description: This pull request adds the feature to configure the maximum number of concurrent jobs per template in the Nomad plugin. It allows users to set a limit on the number of jobs that can be provisioned using a specific template. This can be usefull in case of you nomad pool is shared across differents jenkins AND you do not have the chance to be able to use the premium quota feature.. :)

Changes:

I consider that the parameter with the value -1 is unlimited. In my test, upgrade to the plugin have one issue. Each existing template will the value "0" until the user change it. Is there a way that I could set it to -1 so the default value would be unlimited so it doesn't break existing users configurations ? Thanks for your recommandations and reviews !

aarnaud commented 1 year ago

nice feature, thanks. I hope it will be merged soon.

multani commented 1 year ago

Thanks for the PR @arsiesys !

I won't have time to look in details before end of June though.

In my test, upgrade to the plugin have one issue. Each existing template will the value "0" until the user change it. Is there a way that I could set it to -1 so the default value would be unlimited so it doesn't break existing users configurations?

Not sure how to do that to be honest, but that would be an issue yes (especially if the default value prevents from creating new jobs).

There's a migration helper in MigrationHelper.java, maybe that could inspire you?

arsiesys commented 1 year ago

Thanks for the suggestion ! I indeed checked MigrationHelper.java already but it use the "already" instantiated object "NomadWorkerTemplate" which mean it already wrote a 0 :(. I would need to do it "before" the plugin is init and object "loaded" to inject in the config.xml..

Kamilcuk commented 1 year ago

Hi, please change the default of maximum jobs to some value, like 100. When upgrading, the default is set to 0, which makes it all stuck until manual action to change the value.

Hmmm, I see default=-1 in the source code, need to investigate, please ignore me.

multani commented 10 months ago

@arsiesys I'm not working on the plugin anymore :(

As a last suggestion for your question, I'd suggest to contact the developers mailing list on https://groups.google.com/g/jenkinsci-dev, maybe you will get some help.

Thanks again for the change, and good luck!

gildor7 commented 5 months ago

Hi, can you please merge this change? It is very useful and would solve various resource exhaustion issues! @multani you say you no longer work on the plugin, but it doesn't seem abandoned. Can anyone help?

multani commented 5 months ago

I removed myself several months, please check with @j3t.

Also, feel free to contact the Jenkins project itself via the developers mailing list if you want to participate and move this project forward!