Composer install with satis hg/mercurial

Hello I have problems setting up a php composer project.

My setup is:

An Ant build file with several steps one of those steps is installing the composer packages.

This works fine until a package is downloaded from bitbucket with hg.

[Step 4/5] Permission denied (publickey).
[22:38:20][Step 4/5] Process exited with code 255
[22:38:20][Step 4/5] Step Test bitbucket connection (Command Line) failed
 
What I did so far is:
 
- Generate public and private key and put the public key in bitbucket and the private key in TC.
 
- Added a separate commandline buildstep with the whoami to check under which user TC is executing builds.
- On the teamcity server cmdline I did the same; result same username.
 
- Added a separate commandline buildstep to check bitbucket connection ssh -T hg@bitbucket.org this is failing : [Step 4/5] Permission denied (publickey).
- On the teamcity server cmdline I executed the same command; Connection is ok logged in as ...
 
Why is this failing miserably in a TC build while it's working from shell? Any ideas?

Thanks!

4 comments

Hello,

Please try to run the same build step via command line on TeamCity agent machine under the same user that the agent is running. For more details please see the guidelines. Does the command run successfully? 

0

Ok that sounds logical in our case the buildAgent is running on the same machine and I assume (see the whoami comment in first post) it's using the same user. 

When I run the command on the command line inside the buildAgent it does not work.

I've to load the ssh keys by hand with ssh-add ~/.ssh/xxxxx

After this step it works on the buildAgent from the command line if I do a rerun in TC it fails again.

Question is how can I add those ssh keys? Should I add a VCS root for this? And if so how can I add a private key for Mercurial the interface only shows an username and password field ?

0

Since TeamCity 9.1 SSH Agent build feature is available. It runs an SSH agent with uploaded key during a build. Please try it and let me know if it helps.

0

I've added the ssh private key like you told me and add the ssh agent build feature to and rerun the build this is still not working.

My current setup is this.

- One VCS Git root for main project

- A ssh private key

- A buildfeature ssh agent

- This main project contains a composer.json file to install packages most packages are coming from git public repo's and a few come from a hg bitbucket private repo's

- The hg repo's fail even if I upload my private ssh key which is not being used during build.

Failed to execute hg clone 'ssh://hg@bitbucket.org/username/reponame'  'path/to/store/package'

Are there more things I can check I totally out of ideas :)

 

 

 

0

Please sign in to leave a comment.