jenkinsci / jms-messaging-plugin

https://plugins.jenkins.io/jms-messaging
12 stars 37 forks source link

Save configuration after adding new provider #259

Closed maruiz93 closed 1 year ago

maruiz93 commented 1 year ago

Related Jira ticket - CPAAS-5012 The GlobalConfiguration is resaved when a new provider is added. This solves an existing bug: when jenkins restart, it doesn't found the previously added providers and this cause job triggers listeners to stop working.

Testing done

Added the new testcase AddMessageProviderTest that checks:

Submitter checklist

olivergondza commented 1 year ago

Thanks for your contribution!

Having access to the internal bug tracker, I will note that this is observed IFF this method is called from init groovy script (this plugin never invokes addMessageProvider) and save is not called afterward.

In Jenkins, it is not guaranteed that every change to any Jenkins configurable entity will propagate to disk. It is a responsibility of a caller to make sure the objects changed gets saved once done manipulating it. (Jenkins makes no clear distinction which mutator methods do save internally, and which do not).

Though changing the semantics is not the way to go here. Think of clients that needs to add multiple providers that would result in disk save for each change. This flexibility really belongs to the caller side.