GitLab CI. Path in yml for different users

安稳与你 提交于 2020-01-05 05:26:12

问题


I'm trying to set up GitLab CI for .net project. Now I'm writing script in yml file. What I want to know: the path to the msbuild.exe and mstest.exe may be different for the different team members, how the same yml script may work for different users?
Or may be I'm understand how GitLab CI work in wrong way?


回答1:


The path to the mstest.exe and all other referenced executable and files is based on the machine that has the GitLab runner running.

What's on your machine or anyone else's doesn't matter; Only the build server matters, so write your gitlab .yml accordingly.

Sample .net yml file
    ##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.


来源:https://stackoverflow.com/questions/40716124/gitlab-ci-path-in-yml-for-different-users

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