0

My company's repository hosted on bitbucket custom server which can be only accessed from intranet.

Therefore, I setup a self-host agent for Azure DevOps and this agent could do a git pull and build and release too.

It works and the problem is I have to manually click RUN pipeline to start, and somehow when I pushing commits to my bitbucket custom server it doesn't trigger the Azure DevOps to kick off a build or release.

Is there some other options I could let it automatically triggers the Azure pipeline to run? Webhooks or Hooks?

enter image description here

ske
  • 4,694
  • 3
  • 23
  • 35

1 Answers1

0

I afraid Azure devops pipeline cannot be automatically triggered from a bitbucket custom server. For azure devops server cannot communicate to the bitbucket server hosted in your intranet.

Webhooks or Hooks cannot trigger a build in azure devops pipeline either. Azure devops doesnot have this feature yet. There is an open issue about this.

Currently you might have to trigger your pipeline manually, or create an azure function as mentioned in above link to trigger your pipeline automatically.

Below are some documents about azure function you may find helpful:

Develop Azure Functions using Visual Studio

Continuous deployment for Azure Functions

Azure Functions HTTP trigger:The HTTP trigger lets you invoke a function with an HTTP request.

Best approach to call web api from azure function

Trigger Azure Pipelines build via API

Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43
  • Thanks for your reply! It's feasible. I have done it via https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/queue?view=azure-devops-rest-5.1#request-body – ske May 17 '20 at 23:35
  • Hi @ske That 's great you did it. Where did you call above rest api? I didnot see there was a field to put the request body for above rest api in web hook. Could you share your fix in the answer? I am sure it would help others who want to achieve the same. – Levi Lu-MSFT May 18 '20 at 01:52
  • Using the webhook on the bitbucket side to do a post request to this rest api – ske May 19 '20 at 00:23
  • Thanks for the reminders, i didnot know bitbucket webhook can do a post request. You can post out your solution as answer. – Levi Lu-MSFT May 21 '20 at 09:22