dotnet publish with gitlab-ci for dummies

£可爱£侵袭症+ 提交于 2019-12-07 03:22:45

问题


I am trying to setup ci with gitlab-ci. And I have a few questions about it.

  1. It looks like there is no rollback mechanism on gitlab-ci. So should i care about rolling back if deploy stage fails?
  2. I'am planning to use "dotnet publish Solution.sln -c release" script. But I have multiple projects in this solution. It has one classlib and 2 api. (like AdminApi and UserApi). And these 2 apis are hosted different sites in IIS. In this case, how can i configure dotnet publish script with params?
  3. Should i use something like xcopy for moving publish output to iis folder?

回答1:


I've put an app_offile.htm_for each web sites in iis with "We'll back soon message" in html.

And I've solved my problem with this 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


来源:https://stackoverflow.com/questions/47311770/dotnet-publish-with-gitlab-ci-for-dummies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!