AppVeyor CI-Azure应用服务多环境部署

时间:2018-08-10 17:17:25

标签: asp.net-mvc deployment continuous-integration appveyor azure-app-service-envrmnt

我有一个Asp.Net MVC项目,该项目通过AppVeyor部署到Azure应用服务,其中有一个appveyor.yml文件,该文件配置为将GitHub提交部署到生产和登台。

配置为-

  • 主分支,使用发布配置。
  • 暂存分支,使用暂存配置。

分段部署的构建和部署没有问题,但是,尽管对于Staging分支将分段部署设置为“ Staging”,但该分段部署仍以“ Release”配置为目标。我可以看到这是当我登录到暂存时,它指向暂存Azure SQL数据库。

本地测试

我已经在“登台”配置中对其进行了本地测试,并且在该方面它可以工作。

我假设appveyor.yml文件配置不正确,因此AppVeyor没有选择Staging配置?

version: 1.0.{build}

build_script:
  - ps: .\build.cmd CreateNuGet

nuget:
  account_feed: true

artifacts:
  - path: output\*.*

test: off

for:
# configuration for "master" branch
# build in Release mode and deploy to the Azure prod environment
-
  branches:
    only:
      - master
  configuration: Release

  deploy:
    provider: WebDeploy
    server: [removed for brevity]
    website: [removed for brevity]
    username: [removed for brevity]
    password: [removed for brevity]
    ntlm: false
    remove_files: true
    app_offline: false

# configuration for "staging" branch
# build in Staging mode and deploy to the Azure staging environment
-
  branches:
    only:
      - staging
  configuration: Staging

  deploy:
    provider: WebDeploy
    server: [removed for brevity]
    website: [removed for brevity]
    username: [removed for brevity]
    password: [removed for brevity]
    ntlm: false
    remove_files: true
    app_offline: false

# "fall back" configuration for all other branches
# no "branches" section defined
# do not deploy at all
configuration: Debug

1 个答案:

答案 0 :(得分:0)

我怀疑“后备”配置将覆盖先前设置的配置。通过删除此文件(或将其移动到文件的顶部),您将获得所需的结果。