How to trigger Azure DevOps pipeline when pushing commits to bitbucket custom server? - azure-devops

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?

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

Related

How do I show multiple Azure Pipeline pipelines in GitHub?

We use Azure DevOps for our CI/CD pipelines, but our repositories are in GitHub. We currently trigger the CI pipelines on each push, but there is no link to GitHub so we lose easily seeing the status of a build in pull requests / automatically failing a check if a build fails.
Azure Pipelines has an app on GitHub Marketplace for integrating pipelines with repositories / pull requests. I installed this in our GitHub organization and configured it with the repository access it needs, which then had me authenticate with Azure DevOps, select the project and the pipeline yaml associated with the repository.
This works great and I can see the status directly in a pull request -
The issue is that I have multiple pipelines I would like to run and display the status of in the pull request. We have a monorepo but I only want to build an app if it was modified, so I utilize path filters in the Azure Pipelines yaml so the CI is only run when I need it to. GitHub does not discover/display the status of other CI pipelines I have in the project.
Initially, I tried just setting up another azure pipelines yaml that is triggered by pull requests. When I make a pull request, I see in Azure Pipelines the CI was triggered by 'PR automated for {pr number}', but it does not display it's status in GitHub.
I ended up going to the Azure Pipelines app settings in GitHub, 'revoking' access to the repository, and then immediately re-configuring it with access to the same project as before, but selecting a different pipeline yaml. This worked, it retained the first build I configured and added the second, and now multiple builds are shown in the pull request -
But this does not seem like the intended way to accomplish this. The GitHub app links to the entire documentation for Azure Pipelines, not specifically to docs about the app, and I have not been able to find any info within on how to do this.
Is there a way to add multiple pipelines with the Azure Pipelines app on GitHub, outside of this workaround?

Azure DevOps see included commits in build

we are using Azure Pipelines to build and deploy various projects. We are using Enterprise Github service connection as our git repository source which we are using as part of the build pipelines that are running on on-prem AzureDevops build agent. We are then using on-prem hosted DevOps agents to deploy the service on our on-prem servers.
If we trigger a build we then receive an email notification about all the new commits which are included in the build. Is the same information (what commits are part of the build) included somewhere in the Azure DevOps UI? I was not able to find it and it's really difficult to then determine what I'm actually deploying our various environments as I'm not always the one who triggers each build.
Thanks

trigger azure devops pipeline server from bitbucket server with different branch

using azure devops server 2020
i have the following issue:
i want to trigger azure devops pipeline every time a pull request is opened on any source branch in bitbucket (both azure devops and bitbucket are on-prem servers).
i've managed to trigger a pipeline from bitbucket using bitbucket webhooks, but it triggers the pipeline with the default repo/branch that is conigured - and PRs can be opened on any branch.
I moved to postman to see if i can add a body with some other branch name,
but it doesn't work.
Thank you for the help.

Integrating Service Now with Azure Devops

i am trying to have an integration between service now and azure devops .
If any one can answer below question it be much appreciated.
How to trigger Azure DevOps pipeline automatically on Approving the Change Request in ServiceNow ?
I am approaching with rest API method to call AzureDevops from servicenow plateform.
Does anyone has done something similar and can help me here by listing steps to do so?
You need to create a Service Connection to you ServiceNow instance and then add a Gate in your Release pipeline which creates the Change Request in ServiceNow and then waits for it's status to change.
This provides a good guide - https://learn.microsoft.com/en-us/azure/devops/pipelines/release/approvals/servicenow?view=azure-devops and your gate will end up looking something like this:
You can also use an existing CR but then you'll need a way to supply that to the pipeline on creation of the release.
In the azure devops, we can Install and configure ServiceNow DevOps extension for Azure DevOps to send build and release notifications from your Azure pipeline to ServiceNow DevOps application.
For more details, you can refer this doc: Azure DevOps integration with DevOps

Are the Azure DevOps extensions for Slack affected by changing the Azure DevOps url?

At the company, we will change the URL for the Azure Devops workspace from https://oldname.visualstudio.com to https://dev.azure.com/newname. We have a lot of connections to Slack in Azure DevOps using two approaches. Older links via service hooks in Azure Devops, new links are via slack applications Azure Repos and Azure Pipelines.
Service hooks in Azure DevOps use Slack's Incoming webhooks, so they will not be affected. However, Microsoft prefers to use its Slack Azure Repos and Azure Pipelines extensions, and the way they work is not clear. E.g. Azure Repos is set up in Slack via /azrepos subscribe [https://oldname.visualstudio.com/projecturl] and this step automatically set the address to azdevchatops.azure.com in Azure Devops Service hooks settings.
So it looks like you need to reconfigure all subscriptions in Azure Repos and Azure Pipelines after changing the Azure DevOps URL. But that is a presumption. It is not mentioned in the documentation and that is why I ask. We have enough connections and that means a lot of manual work to configure everything in Slack via /azrepos subscriptions and /azpipelines subscriptions again.
Does anyone have the experience that when using Azure Repos and Azure Pipelines as Slack Apps, everything has to be reconfigured in Slack as soon as the Azure DevOps workspace address changes?
Notification integration is seamless. Notifications work when you change the name (and URL) of Azure DevOps organisation.
I tested just now and everything is ok.
Note: there are another problem. After Azure Devops organisation URL change you need to reinstall/register build agents again to the new URL. If you use hosted Azure Pipelines in cloud, you need in Project Settings > Agent Pools > Azure Pipelines > Agents disable Hosted Agent and enabled again here. Otherwise, CI / CD pipelines do not work.