Hi!, I would like to know if there is a recommended approach as to deploy to an Azure Static Web App from Octopus deploy.
Currently in our project we deploy to Azure Web apps with the corresponding step (template)
(and an Azure web app deployment target configured)
and also to an Azure Static Website (inside a Storage account - $web) using " az storage blob upload-batch"
The package is obtained from an external feed (Artifactory) and de CICD is orchestrated from Jenkins that trigger the deployment using the octopus plugin.
Firstly, welcome to the Octopus community!
As you’ll probably be aware, we don’t currently have a first class step built-in to Octopus to deploy to an Azure Static Website.
The closest I can give you to a recommended approach would be to build a custom step template based off the Run an Azure Script step which incorporates the commands needed to publish your Azure static website (e.g.
az storage blob upload-batch)
The custom step can specify a package parameter so each deployment process can choose the package to be used when uploading.
The alternative would be to use the
az staticwebapp create command, which only supports hosting the content for the site in GitHub, as I understand:
I hope that helps!
is this on your roadmap at all? I currently have it setup using SWA-CLI which I wouldn’t imagine would be that hard for you guys to replicate in a better way
As far as I know we don’t have any concrete plans around this that we can share. We are investing in the foundations of Octopus Server for the first half of this year. It’s possible that this might be picked up later this year, but I can’t guarantee it.
I’d recommend raising it via our roadmap here (there is a Submit Idea button at the top right)
Currently your recommendation does not coincide with the set of tools available on the client. They use Bitbucket OnPrem, and the CICD pipelines on Jenkins and the package repo on Artifactory.
As I understand it, there is no “az” command able to deploy a local package to a static web app
currently for another application we are using with good results the command
"az storage blob upload-batch xxx¨ but it is hosted in Azure as Static Website ($web) in a blob storage account.
Do you have any working example script as to how to deploy a local generated package to an Azure Static web App ?
Unfortunately, I don’t have a working example script. I’m not sure when you say that the package is generated locally whether this means it’s not uploaded to Artifactory as per your initial description.
My suggestion for a solution was for the locally generated package to be uploaded to artifactory (or other feed, Octopus has a built-in one too), then Octopus would download the package as part of the Azure run a script step - the package in question would need to be included/selected in the deployment process by way of the reference package feature
Outside of that, as you rightly mention, there aren’t any supported methods using the azure CLI
az to upload files to an Azure static web app. This is a limitation from Azure, not Octopus.
At the most basic level, Octopus is a script runner, so as @thomas.mcconnell suggested, you could investigate the use of the GitHub - Azure/static-web-apps-cli: Azure Static Web Apps CLI ✨ which does support deploying a static web app. You’d need to ensure that Octopus can access the tool to use it to deploy.
I hope that helps!
It also looks like there is a docker image or the SWA CLI - Docker
This could potentially be used as an execution container image when run within Octopus, which would allow you to use the tool to deploy the static web app through Octopus.
The package would still need to be available to Octopus through either the built-in feed or an external feed such as Artifactory however.
Yes, sorry for the misunderstanding. the package is uploaded to Artifactory, and referenced correctly from an external feed in Octopus Deploy, that is not a problem.
We are now investigating the SWA CLI you mentioned, as to be able to call the correct method from the machine that is currently running Octopus Deploy Server.
No problems at all. I hope you get it all working!