Open seangwright opened 3 years ago
For the pull request based staging environments like GitHub, we currently can’t support them in Azure DevOps due to some differences between the platforms.
You mentioned using multiple stages in a pipeline to deploy to different Static Web Apps. Would it be useful to be able to set up the same pipeline, but instead of deploying to separate Static Web Apps, you can deploy to different environments in the same static web app? For example, you could create dev, qa, staging environments in a static web app, and you can set up a pipeline to deploy to each of those environments, then to production. We are currently evaluating whether we should support something like this.
@anthonychu That would be fine too and very similar to the deployment slots pattern we use with Azure App Service apps.
Would that be a configuration parameter on the AzureStaticWebApp
task or different deployment tokens per environment?
We are looking at using NetlifyCMS and while it does 'work' many of the cool features supported by using GitHub and Netlify don't seem to be possible with DevOps/Azure.
I just spent too long trying to figure out how to 'add' environments to ASWA. Coming from App Services Land, this was very straight forward. I want to add a Dev, QA and keep my Production slot/environment on ASWA. Then I'd like to configure my pipeline to push based on typical review/approve stuff built into DevOps. Right now, I'm having to do what OP does, and stand-up distinct ASWA entities to create test environments.
One of the most important edge conditions for me, is that the API functions bindings should support slot binding. So my Azure function host has three slots ( dev, qa, production ). I'd like to bind my ASWA to a specific API slot. My QA-ASWA would be bound to my QA-Azure function host. The interface does not permit this currently. I plan to open a separate ticket for this.
Is something new with Environments support? We would like to continue using AzureDevOps Environments with approvals for different stages.
We've recently added support for:
Please give it a try and let us know if you have any feedback.
We've recently added support for:
- named preview environments in Azure DevOps
- A skip_api_build flag that allows you to deploy build artifacts without the task rebuilding the app
Please give it a try and let us know if you have any feedback.
Well. Am I right, that
- task: AzureStaticWebApp@0
inputs:
...
deployment_environment: "release"
is a fixed value "release" for deployment_environment?! Every branch (well, could depend on a condition) will be deployed to the same "release" domain?
This issue is about is something like
- task: AzureStaticWebApp@0
inputs:
...
deployment_environment: $(Build.SourceBranchName) <---
I have tested this, does not work (as intended).
This is what my approach for the pull request based staging environments for Azure DevOps / AZDO would be (testing it soon) :
feature/*
(e.g. feature/ticket-123
) branches:pr:
branches:
include:
- features/*
...
- task: AzureStaticWebApp@0
inputs:
# deployments from other branches will create a "preview environment"
# see https://docs.microsoft.com/en-us/azure/static-web-apps/branch-environments
production_branch: main
...
main
branch delete the "preview environment" (here from branch feature/ticket-123
) via az
call:az staticwebapp environment delete --name my-static-app --environment-name ticket-123 --subscription my-sub
The environment name ticket-123
might be extracted from the commit message (I don't know a better way here currently).
⚠️ If I have a running version of this concept I will update my comment here.
We also had the need for a Netlify-like experience with Azure DevOps and SWA:
I expected this feature set out-of-the-box from SWA, but it seems it's missing some pieces yet. We still figured out a way to solve this problem with 2 custom pipelines:
Feel free to check out my repo with all scripts and pipelines combined. The solution has some drawbacks documented in the README. They shouldn't matter that much if everyone is aware of it: https://github.com/feedm3/learning-azure-swa-devops/
There are also some open Issues that could improve working with SWA a lot and may lower the need for a custom solution like mine:
Is your feature request related to a problem? Please describe. Reviewing pull requests in pre-production environments is only supported via GitHub actions today.
Describe the solution you'd like It would be awesome to support this (Static Web App Environments + Pull Requests) in Azure DevOps now that DevOps is a supported repository source for Static Web Apps.
Describe alternatives you've considered The current alternative is to create an Azure Static Web App per environment and use multi-stage build pipelines to deploy changes through environments.
Additional context
See: https://docs.microsoft.com/en-us/azure/static-web-apps/review-publish-pull-requests