TeamCity with BitBucket Cloud Commit Status Publis

2019-04-12 14:59发布

I'm having problems getting the commit status publisher to work.

Details:

  • TeamCity 9.1 Commit Status Publisher Plugin version: snapshot-20160523141816 Bitbucket Cloud
  • git repository type on bitbucket.org

VCS Settings:

  • Configured to use the private key auth (w/ uploaded key)
  • Multiple branches configured.
  • Not using VCS Labeling
  • No PUSH URL specified (should be failing back to FETCH URL, right?)

Commit Status Publisher Settings:

  • I've experimented with these settings, neither email addresses nor usernames work.

Commit Status Publisher Configuration Dialog

But whenever something should publish a commit message, I get this pop up in the TeamCity build configuration list:

Publish status error in build #730 {build id=68270, buildTypeId=Project_BuildConfigurationName}: Cannot publish status to Bitbucket Cloud for VCS root Rootname: response code: 404, reason: NOT FOUND, message: 'Resource not found'

One odd setup thing is that I'm using the ssh://git@altssh.bitbucket.org:443 address to get around some outbound firewall restrictions, though I doubt that would be causing the problem.

Do I need to have the VCS configured with a service account user instead of an SSH Deployment Key? I would rather not do that, if possible.

4条回答
三岁会撩人
2楼-- · 2019-04-12 15:17

Not found means that your user cannot find the repository specified. Usually this means that the vcs settings on the client side are incorrect.

It seems that the issue is that there is no user dedicated for the build itself. **You are unable to use deployment keys to write to the repository. In any shape or form. ** Usual practice is to create a 'build'/'jenkins'/'teamcity' user that has permission to write build output to the bit bucket cloud itself. This is the same as the creation of any other user.

My next question would be do you need to write this information back to the bit unkept cloud itself or just contain the build status externally inside your teamcity instance. Assuming you have good reason to do this you will absolutely need a build user.

查看更多
▲ chillily
3楼-- · 2019-04-12 15:18

Seems that this specific error message is unable to render the name of the root itself. Which suggests it isn't in the system itself.

Publish status error in build #730 {build id=68270,
buildTypeId=Project_BuildConfigurationName}: Cannot publish status to
Bitbucket Cloud for VCS root Rootname:<root_should_be_here> response
code: 404, reason: NOT FOUND, message: 'Resource not found'

See the: Source of the error message, see line 125.

Also potentially interesting: Source of the Repository Object

This means that your bitbucket repo itself hasn't been registered correctly, this is very different from your ability to connect to the repo itself, it should still be able to be registered without the connection itself.

Interestingly this seems to be similar to an issue descripted on the Teamcity Common Issues, where it suggests, if:

VCS root with id "XXX" does not exist The build configuration or template reference a VCS root which is not defined in the system. Remedy actions: Restore the VCS root or create a new VCS root with the id noted or edit the file noted in the message to remove the reference to the VCS root.

查看更多
趁早两清
4楼-- · 2019-04-12 15:23

It's undoubtedly to do with

final VcsRootInstance root = revision.getRoot();

not being able to find the root instance of the git repository. If you can I'd suggest trying this without that firewall there because there may be an issue synchronizing with the server as this page notes

TeamCity regularly queries the version control system for new changes and displays the changes in the Build Configurations that have the root attached

getRoot() is supposed to be returning the

version of VCS root checked out for the build.

and note that this is from the interface Interface SVcsRoot

which is the

Server side class for the vcs root.

So this could definitely be a server side configuration issue that needs to be remedied with a root reconfiguration.

查看更多
Lonely孤独者°
5楼-- · 2019-04-12 15:33

Commit status publisher parses the url you use incorrectly. As a workaround switch to the standard ssh url git@bitbucket.org:owner/repo.git.

查看更多
登录 后发表回答