Specifying user name and password for svn repo in Job configuration.

8,308 views
Skip to first unread message

Ramith Jayasinghe

unread,
Aug 27, 2012, 4:33:10 AM8/27/12
to jenkins...@googlegroups.com
Hi Guys,
 I trying to figure out how to pass credentials (user name and password) for svn repository in the job configuration xml.
I checked the code base [1] and this feature ( per job credential) seems to be available.
So has anyone tried this before? 
Could someone share a sample Xml fragment to do this?


[1] PerJobCredentialStore.java

Regards
Ramith (LSF)

Message has been deleted
Message has been deleted

Qazwart

unread,
Aug 27, 2012, 9:50:23 AM8/27/12
to jenkins...@googlegroups.com
Jenkins can store subversion credentials per job, or under the $HOME.subversion/auth directory.

If you need a different credential for a specific job, go to that job's configuration. Click on the help button by where you enter the Subversion URL. Read the help. There's a link that will allow you to enter a different credential.

--
David Weintraub
Da...@Weintraub.name

Яamith (tm)

unread,
Aug 27, 2012, 11:17:04 AM8/27/12
to jenkins...@googlegroups.com
Hi David,
Thanks for the reply.
When someone enter SVN credentials in the screen [1] you mentioned
that will end up in [2].
Correct me if I'm wrong, but as far as I understood anything that's
stored there will be
for entire Jenkins (not exactly per job).

However, by playing around with jenkins for a while I figured out that
screen available at [3] actually allows User
to set credentials for a specific job ( credentials given will be
stored in job directory).
However, I'm looking for a elegant way of doing this programmatically.

So far what I have managed is to do a HTTP POST to [4] with relevant
parameters and check for HTTP response (and Location header) for
success. So what do u guys think? would this be a clean approach ?


[1] http://<JENKINS_SERVER>/scm/SubversionSCM/enterCredential
[2] <JENKINS_HOME>/hudson.scm.SubversionSCM.xml
[3] <JENKINS_SERVER>/job/<JOB_NAME>/descriptorByName/hudson.scm.SubversionSCM/enterCredential
[4] <JENKINS_SERVER>/job/<JOB_NAME>/descriptorByName/hudson.scm.SubversionSCM/postCredential

Regards
Ramith (LSF)
--
Ɣampire Łestat™
[Coolest Guy on Earth™]

Яamith (tm)

unread,
Aug 28, 2012, 7:33:06 AM8/28/12
to jenkins...@googlegroups.com
Hi Folks,
Any Ideas on this ? ;)

Regads
Ramith (LSF)

David Weintraub

unread,
Aug 28, 2012, 12:35:18 PM8/28/12
to jenkins...@googlegroups.com
On Tue, Aug 28, 2012 at 7:33 AM, Яamith (tm) <ramith...@gmail.com> wrote:
> Any Ideas on this ? ;)

Looking at my setup, it appears that each job has it's own set of
credentials. There's a file called "subversion.credentials" under each
job.

I know that Jenkins will use the Subversion credentials listed under
the $HOME/.subversion/auth if found, so you might want to verify that
file isn't set. I believe Jenkins will use the local job credentials
before trying the global ones.

--
David Weintraub
qaz...@gmail.com

Les Mikesell

unread,
Aug 28, 2012, 1:37:24 PM8/28/12
to jenkins...@googlegroups.com
I think jenkins tries existing global credentials when someone creates
a new job and if they work for the new url, it does not present the
form for adding new credentials and stores the global ones for the
job. At least the ones I've checked are wrong for most of the people
who would have created the jobs... Does anyone have a handy way to
fix this?

--
Les Mikesell
lesmi...@gmail.com
Reply all
Reply to author
Forward
0 new messages