Scope CONFIG_FILE default to manager command structs

What does this MR do?

Scope CONFIG_FILE default to manager command structs

The commands package init() set CONFIG_FILE in the process environment at import time. Because the helper binary, the manager binary, and gitlab-runner steps serve all import this package, the runner-internal default was always present in os.Environ(). In step mode, step-runner's NewEnvironmentFromOS() snapshots os.Environ() into the builtin context that backs user script execution, so CONFIG_FILE leaked into user scripts and broke any tool that read it.

Remove the init() and stop mutating the process environment altogether. Each manager command (list, register, reset-token, run, run-single, unregister, verify) now pre-populates its ConfigFile struct field with GetDefaultConfigFile() in its constructor. urfave/cli renders that as the --help default and still lets env:"CONFIG_FILE" override at parse time via flagFromFileEnv. Precedence is preserved: CLI flag > env > struct default. Helper commands and the steps subtree have no CONFIG_FILE binding, so neither binary populates CONFIG_FILE for those code paths.

Regression coverage in commands/config_test.go:

  • TestCommandConstructorsDoNotMutateProcessEnv: pins the leak fix.
  • TestManagerCommandsDefaultConfigFile: confirms defaults still render.
  • TestConfigFileEnvOverridesStructDefault: locks in env precedence.

Closes #39454 (closed)

Merge request reports

Loading