Thanks Daniel.

I did indeed try hack around at the script console to do it but couldn't
make it work. However I was trying to add to the hostConfigurations list
rather than create a list one and replace the old one so I'll see how I
fair using your suggestion.

Thanks again
Richard.


On Mon, Jan 27, 2014 at 1:18 PM, Daniel Beck <[email protected]> wrote:

> On 27.01.2014, at 00:33, Richard Bywater <[email protected]> wrote:
>
> > I'm wondering if anyone has any pointers/tips/documentation on doing so
> as so far I haven't had much success in working out how to configure
> Jenkins system-type configuration in an automated fashion.
>
> Have you tried the Script Console in Manage Jenkins, or the 'groovysh' and
> 'groovy' commands in Jenkins CLI/SSH? Something similar to the following
> might work (never tried it, so don't run this in production :-) ):
>
> ---
> Jenkins.instance.getDescriptorByType(BapSshPublisherPluginDescriptor.class).with
> {
>   List configs = []
>   configs.addAll(it.hostConfigurations.getView())
>   configs.add(new BapSshHostConfiguration(a bunch of arguments -- look
> them up at [1]))
>   it.hostConfigurations.replaceBy(configs)
>   it.save()
> }
> ---
>
>
> https://github.com/jenkinsci/publish-over-ssh-plugin/blob/master/src/main/java/jenkins/plugins/publish_over_ssh/BapSshHostConfiguration.java#L69
>
> To make this more accessible and have a log, you could create a
> parameterized freestyle job with a system Groovy build step (from Groovy
> plugin) that contains the script.
>
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to