views:

414

answers:

2

Possible Duplicate:
Continuous Integration stack on Windows with Mercurial + Mercurial Queues?

If so, what does your build process look like?

I'm having a difficult time (mostly because of my lack of experience/understanding of all 3 tools) getting TeamCity to run my FinalBuilder scripts. Right now I have FinalBuilder managing all the source control checkouts and TeamCity basically just running the FinalBuilder script and reading in the NUnit test results, but it doesn't work due to authentication errors while executing mercurial commands to kiln.

+2  A: 

If you've installed the Kiln Client on the machine running your FinalBuilder script, you'll have access to the "kilnauth" mercurial extension that should solve this problem for you.

Just log on to the build machine as the user that runs the FinalBuilder script and manually execute one push or pull command from the Mercurial repository you're trying to use, you'll be asked to authenticate. Authenticate once, and the Kiln Client extensions will remember this authentication for this user...and any subsequent runs by the FinalBuilder script should authenticate just fine.

Does this solve the problem for you? It's the best solution as it doesn't store any username or password on your machine. There are obviously other possibilities, like changing the path of your Mercurial to use the format http://{username}:{password}@{kiln url}...but this isn't as nice or safe as the technique above.

Does this make sense?

kamens
We couldn't get this to work with TeamCity, but following the advice from http://www.jetbrains.net/devnet/thread/286891 seemed to fix it...
Byron Ross
+2  A: 

I don't know anything about Kiln, but I've just started working for VSoft and am working on a Mercurial action for the next version of FinalBuilder. Hopefully some of this will help.

Are you athenticating via SSH or SSL? Can you pull/push to the repository from the command line? Pretty much anything you can get to work from the command line should be possible with FinalBuilder.

To authenticate to BitBucket via SSH, I did the following:

  • download puttygen and pageant
  • create a new SSH key in puttygen
  • add the private key to pageant
  • add the public key to BitBucket

From there, I can successfully

hg push ssh://[email protected]/user/repo

NB, I also have TortoiseHG installed, and Mercurial is using TortoisePlink as the ssh client.

If you're using SSL, you can store the username/password combo in your FinalBuilder action. To turn a TextEdit box into a password field, change the PasswordChar property from #0 to *. Then in the ReadData event, add something like

Page.tbPassword.Text = DecryptString(Properties.PropertyAsString("Token"));

and in the WriteData event, add

Properties.PropertyAsString("Token") = EncryptString(Page.tbPassword.Text);

When you add the Token property to your action, tick the Property is Hidden from Action Inspector and Property is Read Only in Action Inspector options.

To generate your repository string, you'll want to do something like this in the Action's GetCommandLine event:

var repo = Context.Properties.PropertyAsString("Repository");
var username = Context.Properties.PropertyAsString("Username");
var password = DecryptString(Context.Properties.PropertyAsString("Token"));
var repo = "ssh://" + username + ":" + password + "@" + repo;

CommandLine.AddArgument("push", repo, qtNone);

NB, I haven't tested that code, but hopefully it gives you an idea.

Ben Hughes