Is there a way to temporarily remove or disable a publisher?

52 views
Skip to first unread message

icetree521

unread,
May 2, 2016, 12:16:45 PM5/2/16
to Jenkins Developers
I am developing an jenkins plugin. I wonder whether there is a way to temporarily remove or disable a publisher ? For example, if I execute publishers.remove(fp), then this publisher will lost permanently.
Is there a way to only temporarily remove or disable it ?

AbstractProject project = build.getProject();
DescribableList publishers = project.getPublishersList();
final Fingerprinter fp =  (Fingerprinter) publishers.get(hudson.tasks.Fingerprinter.class);
publishers.remove(fp);


Baptiste Mathus

unread,
May 2, 2016, 4:49:17 PM5/2/16
to Jenkins Developers
Not that I know of. But you should also be able to indeed remove it, save it, do what you need, then re-add it?

--
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/0ee40860-571a-4f56-bf15-1f7e619aef64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

icetree521

unread,
May 2, 2016, 9:47:36 PM5/2/16
to Jenkins Developers, m...@batmat.net
Thanks for your answer, I can do as what you said. But there is another problem. 

Currently I remove the publisher in the BuildWrapper, which is under the 'Build Environment' section and if I understand right, I would need to re-add this publisher after the build finished, which means I need to add it in the "Post-build Actions" section. Thus my plugin need to configure in both 'Build Environment' section and "  "Post-build Actions" section. I want to my user to only configure in the 'Build Environment' section. 

Is there an way I can re-add the publisher after the build finishes but without extra configuration ?

Jesse Glick

unread,
May 3, 2016, 7:18:57 AM5/3/16
to Jenkins Dev

A plugin should never modify project configuration in the regular course of a build.

Probably what you want is to just to have your `BuildWrapper` do something else when its environment is torn down.

Reply all
Reply to author
Forward
0 new messages