unable to configure bamboo to find ssh (tortoiseplink)

This is a previously reported issue, with no apparent solution. typical windows mercurial setup, with tortoisehg and putty.
mercurial settings correct, and will work via command line, eg. hg clone ssh://hg@mygate/etc works as expected, and
has worked on all clients we have configured for well over a year.

this particular instance is a bamboo build agent. the exception is:

java.lang.RuntimeException : com.atlassian.bamboo.plugins.hg.HgCommandException: command [C:\Program Files\TortoiseHg\hg.exe, pull, --rev, 4f1078e129ffe12bd25979c49f957972c55b3ed7, --config, ui.ssh=ssh -o StrictHostKeyChecking=no -o BatchMode=yes, ssh://hg@mygate/foo] failed. Working directory was `C:\Documents and Settings\oyigit\bamboo-agent-home\xml-data\build-dir\_hg-repositories-cache\b7b75c29066a14265a4be83a36e96f946f326e2b'. stderr: abort: no suitable response from remote hg! stdout: remote: 'ssh' is not recognized as an internal or external command,remote: operable program or batch file.)

note how the outgoing command re-maps ssh as ssh, instead of using mercurial.ini setup, which specifically sets ssh as tortoiseplink, eg.

ssh= tortoiseplink.exe -ssh -i "C:\blah\blah'privkey.ppk"

so what gives? i cannot see any settings that would have my build server to issue the right command to its windows agent, where ssh is tortoiseplink.

yes, I can install some other ssh command, but i need to understand whether this is a bamboo bug i have to work around, or some configuration i have overlooked.

i have already tried setting up a custom executable ssh with the proper path via agents conrol panel. doesn't work.

5 answers

2 votes

You need to set the Bamboo capability: system.hg.executable.ssh to the SSH executable you wish to use. Otherwise it defaults to "ssh -o StrictHostKeyChecking=no -o BatchMode=yes"

To do so, just use the SECOND executabe (SSH) proposed in the add-capability menu for Mercurial...

Do you have any saved sessions in PuTTY?

good question, but no, everything is fresh, no saved sessions. host keys initialized.
i know of a really ugly fix: cp tortoiseplink.exe ssh.exe
but i'd rather have a clean configuration for this.

hg help config

Can tell you where Mercurial expects to find initialization files.

How are you running the agent? What user account? Is it running as a service? With the system account?

Mercurial expects to find your .ini or .hgrc file using the %USERPROFILE% environment variable. Since the Hg command is being spawned by Bamboo thru the agent (which is a Java process) you shouldn't assume that the behaviour you'll see from that will be the same as when logged in with your own user on the Desktop.

Setup a dummy Job with a script task in it and run something like: "hg -v showconfig"

Or make sure the account you're using to run the agent has a USERPROFILE environment variable set. Or you can pass that as an env var in the Job where you need it.

thanks for the response. agent was run in two different ways: once as an nt service, and the other as a "bamboo" administrative user, at console. hg -v showconfig indicates tortoisehg configuration is correct, ui.ssh is properly defined as tortoisehgplink, with pointer to the private key. the bottom line comes to --config line, which defines ui.ssh as ssh. i have no idea what possible configuration could change this: it bypasses mercurial.ini configuration.

Which "autorization type" have you set up in your plan repository configuration?

I'm thinking that the last one, called "Default Mercurial credentials" could force Bamboo to use ssh configured in mercurial.ini... but I might be wrong - can't check it right now.

auth type is keyfile without passphrase. keyfile is supposed to come from the "bamboo" user on the agent, it is specified,
registered etc. but with the --config ui.ssh=ssh line, the actual mercurial configuration that specifies the keyfile is bypassed.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published yesterday in Agile

How Scrum works? It starts with training and education

To answer “How scrum works,” most of the teams I've worked with first addressed the question: “where to start?”  That question applies to both implementation and improvements on the Scrum framew...

168 views 3 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you