GitLab CI。 yml中针对不同用户的路径

时间:2016-11-21 08:56:31

标签: continuous-integration gitlab gitlab-ci

我正在尝试为.net项目设置GitLab CI。现在我在yml文件中编写脚本。我想知道的是:对于不同的团队成员,msbuild.exe和mstest.exe的路径可能不同,yml脚本对于不同用户的工作方式如何?
或者我可能理解GitLab CI如何以错误的方式工作?

1 个答案:

答案 0 :(得分:2)

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.