jenkinsci / ghprb-plugin

github pull requests builder plugin for Jenkins
https://plugins.jenkins.io/ghprb/
MIT License
506 stars 612 forks source link

Changing(rotating) plugin credentials take no effect until Jenkins is restarted due to cached repo object #856

Open sp-ricard-valverde opened 1 year ago

sp-ricard-valverde commented 1 year ago

https://github.com/jenkinsci/ghprb-plugin/blob/ebd6df7b593865c65ae87ef78a0d8255cc90fada/src/main/java/org/jenkinsci/plugins/ghprb/GhprbRepository.java#L63

The ghRepository is being cached when a successful connection is established, but if the connection credentials are ever updated during normal Jenkins operation(in our case, regular credential rotation procedures) the repo object is still reused and never invalidated until Jenkins is rebooted.

It would be nice to have a way to invalidate ghRepository when operating with it if an error is arisen from the underlying client and support updating Jenkins credentials without disrupting operation.