【发布时间】:2016-11-21 08:56:30
【问题描述】:
我正在尝试为 .net 项目设置 GitLab CI。现在我正在 yml 文件中编写脚本。我想知道的是:msbuild.exe 和 mstest.exe 的路径对于不同的团队成员可能不同,相同的 yml 脚本如何适用于不同的用户?
或者我可能理解 GitLab CI 是如何以错误的方式工作的?
【问题讨论】:
标签: continuous-integration gitlab gitlab-ci
我正在尝试为 .net 项目设置 GitLab CI。现在我正在 yml 文件中编写脚本。我想知道的是:msbuild.exe 和 mstest.exe 的路径对于不同的团队成员可能不同,相同的 yml 脚本如何适用于不同的用户?
或者我可能理解 GitLab CI 是如何以错误的方式工作的?
【问题讨论】:
标签: continuous-integration gitlab gitlab-ci
mstest.exe 和所有其他引用的可执行文件和文件的路径基于运行 GitLab 运行程序的机器。
您或其他人的机器上的内容无关紧要;只有构建服务器很重要,因此请相应地编写您的 gitlab .yml。
.net yml 文件示例 ##variables:
## increase indentation carefully, one space per cascade level.
## THIS IS YAML. NEVER USE TABS.
stages:
- build
- deploy
#BUILD
# Builds all working branches
working:
stage: build
except:
- master
script:
- echo "Build Stage"
- echo "Restoring NuGet Packages..."
- '"c:\nuget\nuget.exe" restore "SOLUTION PATH"'
# - '"c:\nuget\nuget.exe" restore "ANOTHER ABSOLUTE PATH TO YOUR SOLUTION"'
- ''
- echo "Building Solutions..."
- C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "SOLUTION PATH"
# Builds all stable/master pushes
stable:
stage: build
only:
- master
script:
- echo "Build Stage"
- echo "Restoring NuGet Packages..."
- '"c:\nuget\nuget.exe" restore "SOLUTION PATH"'
# - '"c:\nuget\nuget.exe" restore "ANOTHER ABSOLUTE PATH TO YOUR SOLUTION"'
- ''
- echo "Building Solutions..."
- C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe /consoleloggerparameters:ErrorsOnly /maxcpucount /nologo /property:Configuration=Release /verbosity:quiet "SOLUTION PATH"
#DEPLOY
stage: deploy
only:
- dev
script:
- echo "Deploy Stage"
#SEND TO YOUR DEV SERVER
## deploy latest master to the correct servers
stage: deploy
script:
- echo "Deploy Stage"
only:
- master
#SEND TO YOUR PRODUCTION SERVER
tags:
- .NET
#put tags here you put on your runners so you can hit the right runners when you push your code.
【讨论】: