dotnet使用gitlab-ci发布虚拟对象

问题描述 投票:4回答:1

我正在尝试使用gitlab-ci设置ci。我有几个问题。

  1. 看起来gitlab-ci上没有回滚机制。如果部署阶段失败,我应该关心回滚吗?
  2. 我打算使用“dotnet发布Solution.sln -c release”脚本。但是我在这个解决方案中有多个项目。它有一个classlib和2 api。 (如AdminApi和UserApi)。这两个api托管在IIS中的不同站点。在这种情况下,如何使用params配置dotnet发布脚本?
  3. 我应该使用像xcopy这样的东西将发布输出移动到iis文件夹吗?
iis .net-core publish gitlab-ci
1个回答
6
投票

我在his中为每个网站添加了一个app_offile.htm_for“我们将很快回复消息”。

我用这个gitlab-ci.yml解决了我的问题

stages:
    - build
    - test
    - deploy
build:
    stage: build
    script:
        - echo "Building the app"
        - "dotnet publish MySolution.sln -c release"
    artifacts:
        untracked: true
    only:
        - dev
test:
    stage: test
    script: echo "Running tests"
    artifacts:
        untracked: true
    dependencies:
        - build
    only:
        - dev
deploy_staging:
    stage: deploy
    script:
        - echo "Deployintg to staging server Admin"
        - ren c:\\inetpub\\vhosts\\xxx\\admin\\app_offline.htm_ app_offline.htm
        - dotnet publish PathToAdmin.csproj -c release -o c:\\inetpub\\vhosts\\xxx\\admin
        - ren c:\\inetpub\\vhosts\\xxx\\admin\\app_offline.htm app_offline.htm_
        - echo "Deployintg to staging server User"
        - ren c:\\inetpub\\vhosts\\xxx\\user\\app_offline.htm_ app_offline.htm
        - dotnet publish PathToUser.csproj -c release -o c:\\inetpub\\vhosts\\xxx\\user
        - ren c:\\inetpub\\vhosts\\xxx\\user\\app_offline.htm app_offline.htm_
    dependencies:
        - build
    only:
        - dev
© www.soinside.com 2019 - 2024. All rights reserved.