Reputation: 344
I've GIT repo in Azure DevOps used in my pipelines.
This repo contains three branchs --> master (useless), PreProd and Prod
In pipeline I working on PreProd branch and after deployment I want to perform a task which merging the latest code in PreProd branch into a new commit in Prod.
So, is that possible and how?
Thanks in advance.
Upvotes: 3
Views: 12614
Reputation: 624
Microsoft has added functionality to run Git commands within pipelines.
Run Git commands in a script - Azure Pipelines | Microsoft Learn
Their documentation also explains how to Merge a feature branch to main, which can easily be converted to work with two different branches such as PreProd
and Prod
.
Upvotes: 1
Reputation: 31075
You could try API as @Tomasz suggested, or invoke git command to merge branches.
In addition, you could try Create Pull Request
task to create a Pull Request and set Auto Complete:
https://marketplace.visualstudio.com/items?itemName=ShaykiAbramczyk.CreatePullRequest
Upvotes: 2
Reputation: 1195
If for some reason GitMerge task is not working for you, try calling Azure DevOps API for Git operations directly from script.
Doc: https://learn.microsoft.com/en-us/rest/api/azure/devops/git/merges/create?view=azure-devops-rest-6.0
Upvotes: 1