1

I'm trying to setup a webhook on bitbucket that forces a build and subsequently runs unit tests every time a PR is submitted. The request is made on the bitbucket side just fine (I can check the "View Requests" section and the calls are being made). However, it's returning a 401 with each call, with the message in the body saying:

Authentication Required

To login manually go to "/login.html" page

enter image description here

To setup the webhook I've done the following:

  • Whitelisted the bitbucket IPs as suggested on this page (outbound IPv4 column only)
  • Connected bitbucket to TeamCity using the following steps:

    1. Go to specific build > Edit Project Settings > Connections > Add Connection

    2. Select Connection Type == Bitbucket Cloud & copy URL (not "Callback URL") enter image description here

    3. Go to Bitbucket > Settings > Add Webhook & paste the URL (not "Callback URL") from step 2 in the URL textbox enter image description here
    4. Select Triggers: Choose from a full list of triggers > Pull Request > Created
    5. Went to my account > Bitbucket settings > OAuth > Add OAuth consumer
    6. Added URL/Callback URL from step 2
    7. Under permissions checked every "Read" box I could see (just trying to get this working)
    8. Copied the Key/Secret in the TeamCity form from Step 2 (still open in another browser)

I'm able to log into the URL from Step 2 on my desktop and manually trigger a build. Also TeamCity can successfully poll bitbucket and kick off builds after a PR has been merged. Can anyone who's succesfully set this up let me know what, if anything, I'm missing?

NealR
  • 10,189
  • 61
  • 159
  • 299

0 Answers0