Hudson svn credentials

2019-02-14 03:42发布

问题:

How to enter subversion credentials in Hudson by shell? I've tried to generate file hudson.scm.SubversionSCM.xml in HUDSON_HOME and reload configuration, but changes weren't applied.

回答1:

The easiest way to enter a credential from the shell is to use "svn" executable. Hudson recognizes the ~/.subversion/auth directory that it creates.



回答2:

Under Windows the global credenentials are stored under %APPDATA%\Subversion\auth. The following Groovy code helps generating these credentials:

SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url))
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(SVNWCUtil.defaultConfigurationDirectory,"AD\user","password",true)
repository.setAuthenticationManager(authManager)
repository.getDir("", -1, null ,(Collection)null) // or some random SVN operation

Libraries used in the code above (example in Gradle):

compile 'org.tmatesoft.svnkit:org.tmatesoft.svnkit:1.7.8'
compile 'net.java.dev.jna:jna:3.4.0' // so wincrypt is available

Make sure you run the code with the same user Hudson runs on the Windows machine.



回答3:

Just start with the Hudson. Install all required Plug-Ins. Hit the link,EX:-localhost:8080/hudson Click on the add job/Create job. While choosing the options SVN will be present there,Give the SVN location. Credentials link is present out there.Click on that link. A form will get open,provide valid credentials for that location of SVN. Observe the Success message on the screen and then get back to the Create job,Complete with Job creation and Build the task.



标签: hudson