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

This widget could not be displayed.

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...

This widget could not be displayed.

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.

This widget could not be displayed.

hg help config

Can tell you where Mercurial expects to find initialization files.
This widget could not be displayed.

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.

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

151 views 16 7
Join discussion

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