trigger azure devops pipeline server from bitbucket server with different branch - rest

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.

Related

Azure DevOps - Pipeline CI/CD - PR automated

Is it normally when creating a pull request manually in bitbucket, to see on Azure DevOps for the pipeline runs:
PR automated for branc_name like below:
I don't want that a pr will be created automatically. I want that the developer create a pr manually and only if the team leader merge, so the pipeline CI/CD is running.
Now what is happened is:
I create a pr manually
Azure DevOps displays that PR automated for branch-name
The pipeline CI/CD is running automatically even i didn't merge the code in the dev branch.

Is there any way to maintain a remote connection when forking from Github to Azure DevOps?

I have used Azure DevOps 'Import Repository' to clone a repo from GitHub so that I can maintain a personal copy. I don't see any way to maintain the remote connection to GitHub so that I can merge in upstream changes.
Does Azure DevOps have such functionality or will I need to do this merging manually/locally?
No there is no way to treat Azure DevOps as a fork for GitHub. You need to manually perform merges and push/pull to and from both GitHub and Azure DevOps.
Not sure why you'd want to use Azure DevOps for your personal clone. As an alternative you can use GitHub for source code repository and link Azure Boards to GitHub and use Azure Pipelines to build, if those are your primary reason to use Azure DevOps.

Azure DevOps Server 2019 - Continuous Deployment only if Pull Request Completes

I have a CI / CD Pipeline configured in Azure DevOps Server 2019.
As soon as a pull request is created a new artifact triggers a release which deploys to the development server even if the pull request is not accepted. How can I restrict the release to server to only when pull request is completed.
From you release definition, you can filter the continuous integration to only run for some branches (only your main branch for instance). You will find more information about how to configure it in the Azure DevOps documentation

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

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

Creating Connection Bitbucket with AzureDevOps

I have a bitbucket repository.
I want pipelines in AzureDevops to build sources when i make a pull request in Bitbucket.
I set up PR trigger in yaml files.
But it did not work when i made a pull request.
I tried to run the pipeline manually, it worked and succeeded.
I guess, bitbucket could not send a message to azure when pull requests are made.
How to set up connection Bitbucket with AzureDevOps?
Integration between BitBucket Cloud and Azure Pipelines:
https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/bitbucket?view=azure-devops&tabs=yaml
You can specify the target branches when validating your pull requests. For example, to validate pull requests that target master and releases/*, you can use the following pr trigger.
pr:
- master
- releases/*
This configuration starts a new run the first time a new pull request is created, and after every update made to the pull request.