1

I want to be able to create and deploy a web application when a feature branch is created from a linked Git repository in Azure Devops and then remove the site and files when the branch is closed.

Creating a new site is straightforward using calculated values to deploy to unique folders, but how would I start to trigger cleanup tasks when a feature branch is merged and closed no longer going to be used?

Graeme Muir
  • 31
  • 1
  • 5
  • Hi, Are you trying to trigger the cleanup tasks in the azure pipeline? Did you check out below answer? How did it go? – Levi Lu-MSFT Feb 11 '21 at 04:19

1 Answers1

0

You can use a service hook to subscribe to the event "Pull request merge attempted". With the webhook you can send a notification to an http endpoint (for example an Azure function) that can host the cleanup logic:

Webhooks provide a way to send a JSON representation of an event to any service. All that is required is a public endpoint (HTTP or HTTPS).

When you subscribe to the Pull Request merge attempted an event of type git.pullrequest.merged is sent to the endpoint for the repositories that matches the criterias in the service hook trigger:

enter image description here

danielorn
  • 5,254
  • 1
  • 18
  • 31