Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
330 stars 56 forks source link

[Azure DevOps Pipeline] Automatically delete branch preview environments after branch deletion #956

Open SchulteMarkus opened 2 years ago

SchulteMarkus commented 2 years ago

In Azure DevOps Pipeline I am using branch preview environments as described on https://learn.microsoft.com/en-us/azure/static-web-apps/branch-environments?tabs=azure-devops

steps:
...
- task: AzureStaticWebApp@0
  inputs:
    ...
    production_branch: 'main'

This works fine as intended.

Feature request Once the branch the preview environment was created for is being deleted, delete the related branch preview environments automatically. For example, by adding an option "auto_cleanup_branch_preview_environments".

Background

rupareddy5-21 commented 1 year ago

Hi @SchulteMarkus , we purposefully don't delete the preview environments in both GitHub and ADO, as the very purpose of the preview environments was to have a stable URLs and the users could link them to auth and API backends and let the users decide to delete these environments if they are no longer used and are not linked anywhere.

SchulteMarkus commented 1 year ago

Hi @SchulteMarkus , we purposefully don't delete the preview environments in both GitHub and ADO, as the very purpose of the preview environments was to have a stable URLs and the users could link them to auth and API backends and let the users decide to delete these environments if they are no longer used and are not linked anywhere.

@rupareddy5-21 With respect, this is not true. The example from above

with:
  action: "close"

shows how to cleanup at GitHub automatically.

rupareddy5-21 commented 1 year ago

Hi @SchulteMarkus, that works for the PR environments when the PR is closed or the corresponding branch is deleted, but not for branch and named preview environments. Please check here - https://learn.microsoft.com/en-us/azure/static-web-apps/preview-environments#deployment-types. Thanks!

jennings commented 1 year ago

@rupareddy5-21 I think this GitHub issue is really asking for PR environments to be supported in Azure DevOps.

I think the naming of "branch environments", "preview environments", and "PR environments" is causing confusion. PR environments can reasonably be considered previews (of what you'll get when the PR merges) and you might also think of them as per-branch environments (because the PR is a separate branch). So all of these names sound like they're referring to the same thing.

I, too, was confused about this until @rupareddy5-21's previous comment, and I re-read the documentation carefully.

I know this isn't something that can be decided in a GitHub issue, but if I were designing the product naming to alleviate this confusion, I would do the following:

If there were only "named environments" and "PR environments", it would be easier to keep straight what each is for.

Reshmi-Sriram commented 1 year ago

That's insightful feedback @jennings! Thanks, we shall rework on naming these in a less-ambiguous way! cc// @craigshoemaker

Nithinbs18 commented 10 months ago

Hi @rupareddy5-21 @Reshmi-Sriram do we have any ADO options to close the PR environments?