Skip to content

WIP: Replace generated shell scripts with gitlab-runner[-helper] invocations

What does this MR do?

Adds a "native shell" script "generator", which configures gitlab-runner to invoke itself (or gitlab-runner-helper in Docker land) with options that result in actions equivalent to generated shell scripts being executed.

This shell type is obviously most appropriate for the "shell" executor, but it will also work for the other types when the gitlab-runner helper binary is available. As we inject the build configuration file into all environments, we could make this more robust by injecting gitlab-runner-helper, using the same mechanism.

This approach also lets us go further with the "no dependencies" philosophy of gitlab-ci-multi-runner. We could even replace external callouts to a "git" binary with calls to libgit2 or something similar instead, if we were feeling brave.

Why was this MR needed?

Shell script generation is error-prone, hard to test, and commits the cardinal sin of interpolating data and code, leading to various escaping problems. We're using Go. It already has solid cross-platform support, so we should use it.

Are there points in the code the reviewer needs to double check?

Does this MR meet the acceptance criteria?

  • CHANGELOG entry added
  • Documentation created/updated
  • Tests
    • Added for this feature/bug
    • All builds are passing
  • Branch has no merge conflicts with master (if you do - rebase it please)

What are the relevant issue numbers?

Closes #1687

Merge request reports