dotnet与gitlab-ci发布傻瓜 [英] dotnet publish with gitlab-ci for dummies
本文介绍了dotnet与gitlab-ci发布傻瓜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用gitlab-ci设置ci。我对此有一些疑问。
I am trying to setup ci with gitlab-ci. And I have a few questions about it.
- 看来gitlab-ci上没有回滚机制。因此,如果部署阶段失败,我是否应该回滚?
- 我打算使用 dotnet publishing Solution.sln -c版本脚本。但是我在这个解决方案中有多个项目。它具有一个classlib和2个api。 (例如AdminApi和UserApi)。并且这2个api托管在IIS中的不同站点上。在这种情况下,如何配置带参数的dotnet发布脚本?
- 是否应该使用xcopy之类的功能将发布输出移至iis文件夹?
推荐答案
我为iis中的每个网站都放置了 app_offile.htm _
I've put an app_offile.htm_
for each web sites in iis with "We'll back soon message" in html.
我用gitlab-ci.yml解决了我的问题
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
这篇关于dotnet与gitlab-ci发布傻瓜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文