How to update Jenkins config.xml from Java code? -
How to update Jenkins config.xml from Java code? -
i new jenkins plugin development pardon me if question silly. developing jenkins plugin provides little list of configuration options shown in attached screenshot.
the form has been designed using jelly script. have update these parameters submitted form in config.xml file of job java code. can suggest way update current config.xml of job in java code?
thanks
after research have got know how update config file through user defined form.
pfb code
abstractitem item= (abstractitem) jenkins.getinstance().getitembyfullname(itemname) source streamsource = new streamsource(new stringreader(config)) item.updatebyxml(streamsource); item.save();
in jelly form has called method this
<f:form method="post" name="config" action="configsubmit">
so code update has placed in method follows
public void doconfigsubmit(staplerrequest req, staplerresponse rsp) throws ioexception, servletexception, descriptor.formexception
java jenkins jenkins-plugins
Comments
Post a Comment