我们使用官方Windows runner来自 Gitlab-ci。我们要上传工件。
我们在 yaml 文件中使用“artifact”关键字来定义需要上传的工件。当我们提交时,这是我们得到的消息:
gitlab-ci-multi-runner 0.7.2 (998cf5d)
WARNING: artifacts is not supported by selected executor and shell
Using Shell executor...
这是因为它使用了 Windows machine?这是怎么回事?
最佳答案
目前不支持从 Windows shell cmd
和 powershell
上传工件。在挖掘源代码一段时间后,我发现根据 gitlab-ci-multi-runner\shells\bash.go bash
确实支持它。
我的工作解决方案是:
- 安装 Bash(已包含在 Git-SCM 中)
- 将 bash 目录 (
C:\Program Files (x86)\Git\bin
) 添加到您的PATH
- 如果您在
cmd
中键入bash
,请确保 bash 启动 找到您的 config.toml 并修改/添加:
executor = "shell" shell = "bash"
重启你的 git-runner 服务
- 确保您的构建脚本采用 bash 语法
(例如使用cmd.exe/c "dir"
从 bash 运行 windows 命令)
关于windows - 使用 Windows Runner 上传工件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34048031/