Custom Persistence For Plugin

25 views
Skip to first unread message

Niv Keidan

unread,
Mar 24, 2020, 12:50:23 PM3/24/20
to Jenkins Developers
Hello everyone.

We have a plugin that extends a cloud (among other classes) and we wish for some cloud related data to be persistent between restarts.
This data changes very often and we need to make sure we save it every time it changes.

At the moment, we are using Jenkins.getInstance().save() but we are not pleased with this solution.

Are there alternatives?
Or, can we customize the way save() behaves?

Appreciate any help/advice.

Thanks,
Niv (Veertu.com)

Gavin Mogan

unread,
Mar 24, 2020, 12:54:18 PM3/24/20
to jenkin...@googlegroups.com
Why are you not pleased with it? What is it doing? What isn't it doing?

--
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/657e2db6-37a5-473d-ae82-34af7b6b0b22%40googlegroups.com.

Niv Keidan

unread,
Mar 24, 2020, 1:21:37 PM3/24/20
to jenkin...@googlegroups.com
Hey, thanks for replying.

Ok, so our plugin implements a cloud (that is saved in config.xml when configured by the user, which is amazing)

This cloud object, after being instantiated (either loaded on startup or changed in configuration), creates all sorts of objects (duh), and those are being saved along with it on every save() execution.

So first, we don't want all this redundant data to be saved (just flood our cloud with transients is a valid solution...?? )

And secondly, all the data that we DO want saved, when scaled up, can increase config.xml size quite massively, and that does not sound nice to us at all.

Any thoughts?


You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/0G7n_sk1ax4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAG%3D_DusP3OBZG9a37ESjuxMNj%3DqxUjKd1pvgixnRzKos%3DdSHHw%40mail.gmail.com.

Jesse Glick

unread,
Mar 24, 2020, 11:41:57 PM3/24/20
to Jenkins Dev
On Tue, Mar 24, 2020 at 1:21 PM Niv Keidan <niv.k...@veertu.com> wrote:
> So first, we don't want all this redundant data to be saved (just flood our cloud with transients is a valid solution...?? )

`transient` makes sense for most cases.

> all the data that we DO want saved, when scaled up, can increase config.xml size quite massively

So this is some sort of cached metadata, rather than actual
configuration? You can store it elsewhere in `Jenkins.rootDir` however
you like. If you want to use the Jenkins style of persistence, you can
use `XmlFile`.

Niv Keidan

unread,
Apr 7, 2020, 8:59:08 AM4/7/20
to Jenkins Developers
Thanks for the tips.

Just for a follow up if any one ever reads this, I have followed the advice as recommended by Jesse.

I made the objects I referred to above transient and we are now handling their load/save by ourselves. We are using XmlFile to do that.

Thanks everyone.



On Wednesday, March 25, 2020 at 5:41:57 AM UTC+2, Jesse Glick wrote:
Reply all
Reply to author
Forward
0 new messages