gpt4 book ai didi

azure - 使用 PowerShell 将代码从 GitLab 存储库部署到 Azure Web App

转载 作者:行者123 更新时间:2023-12-03 14:59:18 36 4
gpt4 key购买 nike

我想使用 PowerShell 脚本设置从 GitLab 存储库到 Azure 应用程序的持续部署。我知道您可以按照以下方式手动执行此操作:

https://christianliebel.com/2016/05/auto-deploying-to-azure-app-services-from-gitlab/

但是,我正在尝试使用 Powershell 来自动执行此操作。我查看了 GitHub 的示例脚本:

https://learn.microsoft.com/en-us/azure/app-service/scripts/app-service-powershell-continuous-deployment-github

但是由于 GitLab 没有提供程序,并且现有提供程序都不接受 GitLab URL,因此我不确定如何继续。我考虑过在 Azure 门户中使用 GitLab 设置手动部署(使用外部存储库选项)并导出资源组模板以获取存储库如何连接到应用程序的详细信息,但出现错误:

Could not get resources of the type 'Microsoft.Web/sites/sourcecontrols'. 
Resources of this type will not be exported. (Code: ExportTemplateProviderError, Target: Microsoft.Web/sites/sourcecontrols)

目前,我正在通过在 GitHub 中镜像我的 GitLab 存储库并使用从那里到 Azure 的持续部署管道来解决这个问题。请注意,这是针对在 GitLab.com 中托管的存储库,而不是在自托管的 GitLab 服务器中。该项目没有 Windows Runner 设置。

如何使用 PowerShell 脚本直接设置从 GitLab 到 Azure 的持续部署?运行安装脚本后,每次后续提交/合并到 GitLab 存储库的操作都应自动部署到 Azure。优选地,此 PowerShell 脚本应使用 AzureRM 模块,但我愿意接受使用 PowerShell Core 和新 Az 模块(基于 Azure CLI)的解决方案。我使用的特定测试存储库是公共(public)的 ( https://gitlab.com/MagicAndi/geekscode.net ),但这并不是解决方案与私有(private)存储库配合使用的具体要求(但如果确实如此,那就更好了!)。

更新2018年12月17日

我已将赏金授予 the-fish因为他的回答最能满足我的具体需求。但是,鉴于 Windows Powershell 和 Azure RM 模块已被弃用,取而代之的是 PowerShell Core 和新的 Az 模块(使用 Azure CLI),我创建了一个 new question使用 Azure CLI 和 Powershell Core 专门询问规范答案。我计划在 2 天内向我开放这个问题时提供悬赏。谢谢。

最佳答案

听起来您正在寻找从 GitLab 到 Azure Apps 的直接部署,但是我建议使用部署管道工具来为您提供更多选择。

Azure DevOps Services管道可能是一个安全的选择,并且有免费套餐,这里有一个 very brief getting started guide for Web Apps deploys .

但是它没有内置对 GitLab 的支持,但似乎有 marketplace tool for integrations with GitLab .

这似乎没有释放触发器的功能,但可以手动触发。其他人有关于 release triggers in the marketplace Q&A 的问题所以也许它会出现在路线图中。

关于azure - 使用 PowerShell 将代码从 GitLab 存储库部署到 Azure Web App,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52664359/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com