【问题标题】:exec: "pwsh": executable file not found in %PATH%exec:“pwsh”:在 %PATH% 中找不到可执行文件
【发布时间】:2021-06-24 03:28:35
【问题描述】:

我一直在尝试在 gitlab CI/CD 上为演示项目启动我的管道。我已经在我的 Windows 本地机器上安装了 gitlab-runner,并将执行器类型指定为“Shell”。我已经成功地将 gitlab-runner 与我的 gitlab 项目集成在一起。但是,每当我将任何更改推送到 repo 时,管道都会启动并最终以“pshw”结束,在 %PATH 错误中找不到。 This is error which I'm getting every time

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

谁能帮我解决这个问题并解释我收到这个错误的原因和原因。

提前致谢

【问题讨论】:

    标签: gitlab-ci gitlab-ci-runner powershell-core


    【解决方案1】:

    在选择shell选项时,gitlab runner安装程序使用pwsh作为执行程序。它会生成一个config.toml,看起来像

    [[runners]]
      name = "some name"
      url = "http://someurl.com/"
      token = "some-token"
      executor = "shell"
      shell = "pwsh"
    

    问题是 pwsh 不是有效的 Windows 命令(在我的安装中)。将pwsh 更改为powershell 并重新启动gitlab-runner 服务为我解决了这个问题。

    【讨论】:

    • 如何在安装本身中将默认 shell 更改为 powershell,而在进行另一个安装时,我仍然将默认 shell 作为 pwsh 而不是 powershell
    • @Clueless,显然,在安装/注册期间不能指定这一点,而是更改 config.toml 文件
    【解决方案2】:

    转到 GitLab Runner 的安装目录,例如C:\Automation\GitLab-Runner。在这里你会看到 config.toml 文件,用记事本打开并用 powershell 替换 pwsh 如下:

    发件人:

    [[runners]]
      name = "PT-Runner"
      url = "https://gitlab.com"
      executor = "shell"
      shell = **"pwsh"**
    

    收件人:

    [[runners]]
      name = "PT-Runner"
      url = "https://gitlab.com"
      executor = "shell"
      shell = **"powershell"**
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-21
      相关资源
      最近更新 更多