Question

In my Jenkins plugin this code is used to create an instance of SVNClientManager:

final SVNClientManager svnm = SubversionSCM.createSvnClientManager(build.getProject());

It works fine on the master, but to support slaves I have to change it from

SubversionSCM.createSvnClientManager(AbstractProject)    

to

SubversionSCM.createSvnClientManager(ISVNAuthenticationProvider)

According to the documentation these steps are required to get a instance of ISVNAuthenticationProvider:

Therefore, to access ISVNAuthenticationProvider, you need to call this method on the master, then pass the object to the slave side, then call SubversionSCM.createSvnClientManager(ISVNAuthenticationProvider) on the slave.

But I have no clue how to implement it. How to ensure that a method is called on the master? Please provide a short example (maybe based on the default plugin "HelloWorldBuilder").

Était-ce utile?

La solution

After hours of testing I found it out by myself. Use the main instance to ensure that you call the function "createAuthenticationProvider" on the master. I put this functionality in a separated method of the plugin:

private ISVNAuthenticationProvider createAuthenticationProvider(AbstractProject context) {
    return Hudson.getInstance().getDescriptorByType(SubversionSCM.DescriptorImpl.class)
            .createAuthenticationProvider(context);
}

During the execution of the plugin you can generate a valid AuthenticationProvider by calling the method:

createAuthenticationProvider(build.getProject())
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top