代码改变世界

天行健,君子以自强不息

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  108 随笔 :: 0 文章 :: 3 评论 :: 22088 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

摘要

这是在Windows中摸索Gitlab Runner的第一个坑:默认的值是“pwsh”。

错误提示:

Running with gitlab-runner 16.9.0 (656c1943)
  on Alice-WIndows-11 ********, system ID: s_**********
Preparing the "shell" executor 00:00
Using Shell (pwsh) executor...
Preparing environment 00:00
ERROR: Job failed (system failure): prepare environment: failed to start process: exec: "pwsh": executable file not found in %PATH%. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

错误的地方

config.toml的原始配置

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "wz94"
  url = "https://code.com/"
  token = "id7_cuyyyA-xWzNhtdsB"
  executor = "shell"
  shell = "pwsh" # 初始值是这个,正确应该修改成:shell = "powershell"  
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]

1、网上有人说,删除这一行

或者改为

shell = ""

这样就会造成流水线无法获取到.gitlab-ci.yml中定义的变量。

正确做法

shell = "powershell"

本文在说什么?

说的是Gitlab Runner的config.toml文件,正确文件完整展示如下:

concurrent = 1
check_interval = 0
connection_max_age = "15m0s"
shutdown_timeout = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "Alice-WIndows-11"
  url = "https://gitlab.********.cn"
  id = 37
  token = "********-******************"
  token_obtained_at = 2024-04-11T16:39:42Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "shell"
  shell = "powershell"
  [runners.cache]
    MaxUploadedArchiveSize = 0

未完待续……

posted on   终南山人  阅读(173)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类
点击右上角即可分享
微信分享提示