views:

491

answers:

4

I have a project that uses SVN externals to include some stuff (actually it's the MSBuild Community Tasks, but that's tangential). The external repository requires a username 'guest' but no password.

I've set an externals property and this works perfectly when doing an SVN Update locally. The problem comes when my TeamCity continuous integration build runs. TeamCity tries to checkout the sources and chokes on the externals, because it doesn't know the username.

I've tried defining the externals as a separate SVN root in TeamCity, but that doesn't work so I don't think it is the solution.

So how do I make this work? How do I let TeamCity know that it needs to log in to the external SVN repo?

+1  A: 

Authentication information is stored in a configuration file local to the user running the program. Or at least, it can be configured to do that.

I bet TeamCity's Agent program runs under a different user than the one you log into the machine with. If it does, you should try just logging into the machine with the same user, then do a svn checkout to a temporary directory and fill in the username and password. This will be cached, and thus when TeamCity runs SVN under the same user, it should reuse that information.

Lasse V. Karlsen
That's one way I guess, but it doesn't seem very robust. I would have to do that on every build agent for every external reference, for example. Plus, the cached credentials might get cleaned up, etc. I was really hoping maybe there was a way to do this declaratively, in a settings or configuration file.
Tim Long
A: 

I've never used TeamCity, but have used other CI tools.

Instead of having TeamCity poll the svn repo for new revisions. Maybe have a post commit hook invoke TeamCity, but prior to doing so, have it run an ant script that svn updates a directory local to the TeamCity server. First time you checkout to this directory you should have the opportunity to set externals.

Phillip Jacobs
Thanks for the suggestions, but I think that's too messy and would short-circuit a lot of the nice features that TeamCity has around VCS integration and build triggering. Plus, the build agents run on different boxes to the TeamCity server so checking out to a hard-coded directory probably will not be very maintainable. I'm trying to reduce dependencies of fixed locations as much as possible.
Tim Long
+2  A: 

If no password is required, only a username then you can easily set this up in the servers config file (on Windows, it's located in %APPDATA%\Subversion\servers).

Specify the server and then set the 'username' option. For example:

[groups]
communitytasks = *.comunityserver.com

[communitytasks]
username = guest
Stefan
Let me see if I understand this correctly. You;re saying that I need to do this on _my_ SVN server, even though the externals are on someone else's server? I may be misunderstanding how externals work. I was thinking that the client checked out the externals, but what you are suggesting is that the _server_ goes out and gets the externals, is that correct?
Tim Long
No, it's not the server that gets the externals. But there's a 'servers' file used by svn *clients* too - that's where all the network stuff is configured and how to access those. And since the client accesses the externals, you have to configure it there.
Stefan
I have the exact same problem (except I do need to specify a password). I looked at the servers file but I only see options for setting a proxy username and password. How can you specify a repository username and password?
Zack
+1  A: 

TeamCity uses cached authentication information from SVN client to access externals. There is no other way to specify externals authentication information other than access remote server from command line client, cache credentials locally, and have TeamCity use them (in TeamCity SVN settings there is a checkbox whether to use stored SVN settings)

KIR