My best try to update jobs' config was using a groovy script with the
groovy plugin. Create a job object from an xml file using XStream.fromXml
and then create or get a job from your jenkins instance, store the values
of the loaded properties into the second job instance and do job.save().
That should work.

This way I have patched lots of jobs where the config slicing plugin could
not help.

Regard, Frederik

2012/7/27 Michaël Pailloncy <[email protected]>

> I've tried :
> AbstractItem item = (AbstractItem) Jenkins.getInstance().getItem("myjob");
> File directoryConfigXml = item.getConfigFile().getFile().getParentFile();
> Item updatedItem = Items.load(item.getParent(), directoryConfigXml);
> Jenkins.getInstance().putItem((TopLevelItem)updatedItem);
>
> It works, but it delete and re-create the job.
> Nobody knows a more simple way to just reload the job configuration from
> disk (without having to reload all Jenkins configurations) ?
>
> Thank you in advance for any help.
>
>
> 2012/7/26 mpapo - Michaël Pailloncy <[email protected]>
>
>> Hi,
>>
>> I would like to reload config.xml file of a job programmatically.
>> I've tried :
>> AbstractItem item = (AbstractItem) Jenkins.getInstance().getItem("myjob");
>> File directoryConfigXml = item.getConfigFile().getFile().getParentFile();
>> Items.load(item.getParent(), directoryConfigXml);
>>
>> But this code portion does not reload configuration and the jobs still
>> has its old configuration in cache.
>>
>> If I reload Jenkins, the configuration is correctly reloaded.
>>
>> How can I reload the configuration of my job?
>>
>>
>>
>

Reply via email to