摘要
这是在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
未完待续……
黑夜里不停折腾的代码行者。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· AI与.NET技术实操系列(六):基于图像分类模型对图像进行分类