Skip to content

CI/CD Runner run_exec script file name is incorrect for bash shell type on Windows (eg. MinGW)

I'm trying GitLab CI/CD. My program is built by MinGW, so I use custom executor and bash shell profile on Windows.

My config.toml:

[[runners]]
  executor = "custom"
  shell = "bash"
  [runners.custom]
    run_exec = "C:/MSYS2/usr/bin/bash.exe"
    run_args = []
  [runners.custom_build_dir]

But when I run the job, it report

/usr/bin/bash: C:\Users\ADMINI~1\AppData\Local\Temp\custom-executor3950479982\script125115341\script.: No such file or directory
ERROR: Job failed (system failure): prepare environment: unknown Custom executor executable exit code 127; executable execution terminated with: exit status 127. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

So I print the actual command called by gitlab-runner for Windows:

C:/MSYS2/usr/bin/bash.exe C:\Users\ADMINI~1\AppData\Local\Temp\custom-executor3950479982\script125115341\script. prepare_script

And find that the second arg have a trailing dot on script name/path, but in file system, this script file name actually have no dot.


(screenshot from https://docs.gitlab.com/runner/executors/custom.html#run)

image