gpt4 book ai didi

azure - Azure 静态 Web 应用中的部署槽如何工作

转载 作者:行者123 更新时间:2023-12-02 07:51:47 24 4
gpt4 key购买 nike

我在 Azure 门户中创建了一个静态 Web 应用程序,用于托管我的 Angular 应用程序。创建向导自动在我的 Azure Repo 中生成管道。如果我转到 Azure DevOps,我可以看到管道的 YAML,如下所示:

name: Azure Static Web Apps CI/CD

pr:
branches:
include:
- master
trigger:
branches:
include:
- master

jobs:
- job: build_and_deploy_job
displayName: Build and Deploy Job
condition: or(eq(variables['Build.Reason'], 'Manual'),or(eq(variables['Build.Reason'], 'PullRequest'),eq(variables['Build.Reason'], 'IndividualCI')))
pool:
vmImage: ubuntu-latest
variables:
- group: Azure-Static-Web-Apps-purple-bush-094d6d303-variable-group
steps:
- checkout: self
submodules: true
- task: AzureStaticWebApp@0
inputs:
azure_static_web_apps_api_token: $(AZURE_STATIC_WEB_APPS_API_TOKEN_PURPLE_BUSH_094D6D303)
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/" # App source code path
api_location: "" # Api source code path - optional
output_location: "dist/propworx-portal" # Built app content directory - optional
###### End of Repository/Build Configurations ######

因此,这将构建我的存储库的主分支并将其发布到生产环境。

现在我真的是一名后端开发人员,之前只使用过 Azure Web Apps。这是我第一次使用 Azure 静态 Web 应用。在 Azure Web Apps 中,我将创建部署槽,并将我的暂存分支部署到我的暂存槽。测试后,我将交换暂存槽和生产槽。

我正在努力弄清楚如何使用 Azure 静态 Web 应用来重现某些内容,至少是类似的内容。 Azure 门户上没有“部署槽”部分。如果我理解正确的话,插槽会根据我的存储库分支自动创建吗? (以及我为他们创建的管道?)。因此,我认为我需要创建一个新的管道来构建我的暂存分支并将其发布到暂存槽。但是,当我尝试这样做时(通过创建新管道并复制粘贴主管道的 YAML)并将 YAML 中的“分支”从“master”更改为“staging”,然后手动运行管道,它仍然部署到与其他主管道相同的 URL。我需要将其部署到不同的 URL(即不同的插槽)。此外,当我将提交推送到暂存分支时,管道不会自动运行,就像我将提交推送到主分支时主管道运行的方式一样。

任何指导/提示/指示将不胜感激!谢谢。

最佳答案

静态 Web 应用程序没有部署槽,但有称为预览环境的东西。您可以使用 deployment_environment 输入控制部署任务部署到的环境。

可以找到文档 from here 。我并没有真正使用太多环境分支,但我猜想从暂存分支部署到暂存槽最接近的等效方法是将deployment_environment设置为要使用Web应用程序部署到生产槽中的任何分支,来自该分支和登台分支的管道触发器。

关于azure - Azure 静态 Web 应用中的部署槽如何工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75615319/

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