Why isn't SSH VCS supported for "pull requests" build feature?

Answered

We have TeamCity using SSH to access our BitBucket projects, and that's been great.

Now I'm trying to add a pull request trigger for it, and it seems to be unsupported in the docs. That makes no sense to me, so I tried it anyway, and I got this error: 

Using SSH key authentication method to extract pull request information is impossible. Please provide an access token
What on earth? Getting pull request data using SSH is *not* impossible.
 
Obviously, I can & will use HTTP for the time being, but using SSH for this seems like fairly core functionality to me. So what's going on here? Why isn't this supported?

 

0
5 comments

Hello Mblakesley,

I assume you are talking about the Pull Requests build feature. This build feature uses API of the target system to work with pull requests. We rely on available authentication methods, which, for Bitbucket Server, are limited to basic authentication. Bitbucket requires either a user:password, or a user:token pair. Which is why it is impossible to use SSH keys there.

0

Hmm, well maybe this is an annoying response, but Jenkins can do this. We've configured SSH creds for Bitbucket, which Jenkins uses to pull down & build PRs. Why would Jenkins be able to do this but not TeamCity?

0

You can build pull requests with SSH in TeamCity, you will need to adjust your branch specification accordingly (see examples in the pull requests build feature documentation, for Bitbucket Server it should be: refs/pull-requests/*/from). This way TeamCity will detect and build all pull requests with SSH keys. As I mentioned before, it is not possible to do via the Pull Requests build feature, because the feature uses Bitbucket's REST API, which does not allow authenticating via SSH keys. 

There are several downsides to this approach. TeamCity will not automatically remove branches from the branch selector once the corresponding pull requests are closed. You will not be able to use special parameters that the Pull Requests feature introduces. You will not see some corresponding UI changes that the feature introduces. 

0

On a side note, I was browsing the documentation for the Jenkins plugin that does the same work, and it dawned on me that maybe your repository is public. Is that so? The plugin allows working with public repos and allows using OAuth. I believe this is something our build feature may be missing.

0

Sorry for delayed response, but no, our repo that's set up with Jenkins isn't public, and it uses SSH, not OAuth.

0

Please sign in to leave a comment.