Tim Long
Tim Long

Reputation: 13798

SVN externals and automated build

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?

Upvotes: 4

Views: 2975

Answers (5)

Animism
Animism

Reputation: 496

Not specific to TeamCity, but if you need to specify which username to use when checking out an svn:externals repository:

In the svn:externals property, don't specify a username:

the_vendor_dir     svn+ssh://hostname/path/to/repo

By default, checkouts will then use the current user's username. To use a different username:

~/.subversion/config:
[tunnels]
ssh = $SVN_SSH ssh -ljdoe

That will cause Subversion to use jdoe as the username for any svn+ssh tunnel that doesn't specify a username.

Instead of changing the svn+ssh tunnel at the Subversion level, you could also change it at the SSH level:

~/.ssh/config:
Host svn.example.com
   User jdoe

Stefan's answer above about ~/.subversion/servers didn't work for me, and doesn't seem like it should work since the username setting is not a documented in that file.

Upvotes: 1

Stefan
Stefan

Reputation: 43585

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

Upvotes: 4

KIR
KIR

Reputation: 5712

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)

Upvotes: 2

Phillip Jacobs
Phillip Jacobs

Reputation: 168

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.

Upvotes: 0

Lasse V. Karlsen
Lasse V. Karlsen

Reputation: 391734

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.

Upvotes: 2

Related Questions