gitlab-runner在windows中.gitlab-ci.yml文件的配置方法

gitlab-runner的配置

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "yourname"
  url = "https://git.yourname.com/"
  token = "yourtoken"
  executor = "shell"
  shell = "powershell"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]


.gitlab-ci.yml文件

Job:
 stage: deploy
 only: ["yourname"]
 tags: ["yourtag"]
 script:
   - chcp 65001
   - echo "spend my 10 hours"
   - "C:"
   -  cd C:\www\
   - powershell
   - git checkout . 
   - git pull


说明:
代码的细节不重要。重要的是思路。
gitlab-runner运行在linux下时,运行良好,但在windows下却出问题。
最严重的问题是.gitlab-ci.yml配置内的git无法运行。但在windows服务器内直接测试是可以运行的。
后来发现,配置的script并没有运行起来powershell,而是在cmd下运行的。但是在windows服务器内的cmd下git是可以运行的。
为什么windows是这样的呢?


猜你喜欢

转载自www.cnblogs.com/codeaaa/p/12519800.html