问题
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.
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.
回答1:
Commit status publisher parses the url you use incorrectly. As a workaround switch to the standard ssh url git@bitbucket.org:owner/repo.git.
回答2:
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.
回答3:
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:
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.
来源:https://stackoverflow.com/questions/37556213/teamcity-with-bitbucket-cloud-commit-status-publisher-404-errors