We use BitBucket for our source control and VSTS for CI. VSTS build definition has a trigger option which will monitor the repository every so many seconds (min is 60s) and if new changes are there it will trigger the build. But that feature only works when you have VSTS repositories and for any external repository the developer needs to login to VSTS after the changes are pushed and wait for at least 60 seconds for the build to kick off. I’m pretty sure that manually triggering the build takes less time. Also, that model by itself is not efficient specially in the world of Webhooks.
BitBucket supports Webhooks. For example you can call add Webhooks for each push (unfortunately you can not specify a branch). The problem is that VSTS CI build definition does not accept Webhooks as trigger.
In this post I’m going to show how this can be done by using BitBucket Webhooks , Azure Function Apps and VSTS REST API.