在部署到 Azure 应用服务之前,我是否必须压缩项目?

Do I have to zip up the artifacts before deploying to Azure App Service?

我目前正在完成创建 CI 开发管道并参考以下文档

所有参考文献都表明工件先压缩、发布,然后部署。

但是,项目开发人员告诉我,在构建 .NET 之后,他只是 copies/deploys 将生成的 AngularOutput 工件发送到 Azure 应用程序服务。

我用归档任务测试了它然后发布,CI 管道工作得很好。但是,我也测试了直接发布而不事先存档,我将路径更改为\Bundles\AngularOutput,发布步骤成功并显示了发布的工件

那么问题来了,如果没有先zipping/archiving发布作品,那么我可以在发布作品后直接部署吗?如果是这样,需要为 Azure App Service Deploy task: Package/Folder?

指定什么

如果归档任务是 necessary/recommended,那很好,但这是否意味着 Azure 应用服务部署会自动提取压缩的工件?

首先,是的,您可以发布您的工件,而无需将它们作为工件实际发布到管道上。但是,如果您将它们发布到管道上并将构建和发布管道分开,您可以重新部署而无需重建您的应用程序。

您也可以随时下载工件并在需要时手动发布它。 (例如某些 development/debug 目的)。

Zip deploy方法

这里用到

Creates a .zip deployment package of the chosen Package or folder and deploys the file contents to the wwwroot folder of the App Service name function app in Azure. This option overwrites all existing contents in the wwwroot folder. For more information, see Zip deployment for Azure Functions.

因此,如果您需要从构建管道部署它,您只需将路径放入您的 zip 文件或内容所在的文件夹文件。

请考虑 multi stage pipeline where you can separate build and deploy phases among stages. However, in this case you need to publish your artifact as a pipeline artifact. And this pipeline artifact will be downloaded automatically on deployment job