Skip to content

Rename DEBUG env var to RUNNER_DEBUG

Arran Walker requested to merge 3068-debug-set into main

What does this MR do?

Renames DEBUG environment variable to RUNNER_DEBUG.

--debug and debug: true are still the command-line and config.toml equivalents respectively - only the environment variable name changes.

Why was this MR needed?

DEBUG is a very generic environment variable that can be used as part of CI jobs. This collision prevents gitlab-runner helper functions from working, due to the follow:

In our abstract shell, we use this to determine if the helper tool is available:

w.IfCmd(runnerCommand, "--version")
f()
w.Else()
w.Warningf("Missing %s. %s is disabled.", runnerCommand, action)
w.EndIf()

Here we expect gitlab-runner-helper --version to return successful. Instead however, for an non-boolean DEBUG value, it returns:

DEBUG=hello ./gitlab-runner --version

FATA[0000] could not parse hello as bool value for flag debug: strconv.ParseBool: parsing "hello": invalid syntax 

What's the best way to test this MR?

Try change with and without DEBUG set to a non-boolean value.

What are the relevant issue numbers?

Closes #3068 (closed)

Merge request reports