使用Windows Runner上载工件

E. *_*oel 5 windows artifacts runner gitlab-ci

我们使用Gitlab-ci 的官方Windows运行程序.我们想上传文物.

我们在yaml文件中使用'artifact'关键字来定义需要上传的人工制品.当我们提交时,这是我们得到的信息:

gitlab-ci-multi-runner 0.7.2 (998cf5d)
WARNING: artifacts is not supported by selected executor and shell
Using Shell executor...
Run Code Online (Sandbox Code Playgroud)

这是因为它使用的是Windows机器吗?这是什么交易?

ker*_*rot 5

cmd目前powershell不支持从 Windows shell 上传工件。经过一段时间的挖掘源代码后,我发现根据gitlab-ci-multi-runner\shells\bash.go bash确实支持它。

我的工作解决方案是:

  1. 安装 Bash(已包含在 Git-SCM 中)
  2. 将 bash 目录 ( C:\Program Files (x86)\Git\bin) 添加到您的PATH
  3. bash如果您输入以下内容,请确保 bash 启动cmd
  4. 找到你的 config.toml 并修改/添加:

    executor = "shell"  
    shell = "bash" 
    
    Run Code Online (Sandbox Code Playgroud)
  5. 重新启动你的 git-runner 服务

  6. 确保您的构建脚本采用 bash 语法
    (例如使用 bash 从 bash 运行 Windows 命令cmd.exe /c "dir"