404 error with TeamCity and bitbucket for 'Commit status publisher'

Denis Kaloshin June 27, 2019

Hi.

I use TeamCity for CI.

When I set up VCS Root to work with git and bitbucket repositories all works fine.

I mean that I have successful connection.

But when I tried to set up 'Commit status publisher' from TeamCity to bitbucket I get

Bitbucket Cloud publisher has failed to connect to "https://bitbucket.org/mycompany/myrepo/src/master" repository: HTTP response error, response code: 404, reason: Not Found

Why? What's problem?

2 answers

1 accepted

1 vote
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 27, 2019

Hi @Denis Kaloshin,

I can think of two cases:

  1. assuming that authentication is fine (you got 404, not 401) this can be because master branch doesn't exist in your actual repo
  2. maybe the URL shown in the error is not what TeamCity tried to request. Could you please check TeamCity logs and find exact Bitbucket URL that returned 404?

Honestly, I'm not too familiar with TeamCity setup, but anything that posts commit status to Bitbucket in fact shouldn't use the URL you mentioned but instead use REST API.

Hope this helps.

Cheers,
Daniil

Denis Kaloshin June 28, 2019

Hi @Daniil Penkin

Thanks for reply.

1. master branch exists, because I can see it in browser by "https://bitbucket.org/mycompany/myrepo/src/master" link

2. I couldn't find this operation in Team City logs, very strange.

How to use REST API to send build status to Bitbucket repo?

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 28, 2019

Hi @Denis Kaloshin,

  1. I just tried connecting TeamCity build to Bitbucket Cloud with the Commit status publisher and didn't get any errors – build status was successfully reported to Bitbucket. I didn't see any screen where I'd need to input anything other than Git repo URL https://bitbucket.org/<workspace>/<repo_slug>, so I'm wondering maybe you specified the longer one, with /src/master, in VCS root setting and it works fine for cloning (TeamCity might be stripping it?) but confuses Commit publisher plugin? Could you verify your VCS root settings?
  2. Well, unfortunately I can't help with this. Not sure where it's being logged.
  3. /{username}/{repo_slug}/commit/{node}/statuses/build endpoint is used for this, there's also a nested one to update (you can first post "INPROGRESS", then update it with the outcome.

Let me know if this works for you.

Cheers,
Daniil

Denis Kaloshin June 28, 2019

Hi @Daniil Penkin 

1. Yes, that helped me to get Success Connection in Commit status publisher. This path https://bitbucket.org/<workspace>/<repo_slug> works. I tried with /src/master before that.

I ran one build and I haven't seen the build status in the Bitbucket (Builds column).
What's wrong? May be permissions problem.

No information in TeamCity logs.

2. Ok, no problem.

3. Thanks, may be later I'll try.

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 29, 2019

Hi @Denis Kaloshin

Read access to the repo should be enough. What page are you looking at to find build status? Can you double check /<workspace>/<repo_slug>/commits page?

Cheers,
Daniil

0 votes
Denis Kaloshin July 1, 2019

Hi @Daniil Penkin 

Great, I can see the build statuses on /<workspace>/<repo_slug>/commits page.

But on this page /account/user/%7B4eb53fe3-71f1-4dfa-beeb-dbed585f89cb%7D/projects/<project> (Repositories page with Last updated & Builds columnsthere is nothing about build information. Why?

Denis Kaloshin July 1, 2019

Now it's correct. When I built the master and the release branches.

Like Daniil Penkin likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events