actions / runner

The Runner for GitHub Actions :rocket:
https://github.com/features/actions
MIT License
4.91k stars 965 forks source link

Unable to customize Runner PATH envvar without disregarding changes to system PATH envvar #3292

Open BrianCArnold opened 6 months ago

BrianCArnold commented 6 months ago

What would you like added?

Why is this needed?

Additional context

There are two initial solutions I can think of:

  1. Create a .env_parsed file that will replace any environment variables present to the right of an = with the value of that environment variable. (PATH=D:\actions-runner\tools;$PATH is mutated to PATH=D:\actions-runner\tools;C:\Windows\System32;C:\Win... before being

Describe the bug

Add the ability to specify a prepended or postpended set of directories to the existing PATH variable for the runner context.

To Reproduce

  1. Install GCC and Python on Windows
  2. Install the runner
  3. Add a utility in D:\actions-runner\tools solely for the use of the runner
  4. Customize the PATH in .env PATH=D:\actions-runner\tools;C:\Windows\System32;C:\Win...
  5. Install Perl

It is now necessary to manually add the new Perl path from the System-wide PATH variable to the PATH variable of the runner,

Expected behavior

It would be ideal to be able to specify additional directories that could be added to the PATH, rather than requiring that admins specify the exhaustive list of PATH directories.

Runner Version and Platform

Version of your runner? 2.316.1

OS of the machine running the runner? Windows Server 2019 Standard

What's not working?

Can't add directories to PATH for runner without listing all directories from system PATH envvar.

Job Log Output

N/A

Runner and Worker's Diagnostic Logs

N/A

After reviewing the associated code that processes the .env file , I believe it would be quite simple to add code similar to the existing parsing of .env by parsing a secondary file (perhaps called .env_parsed and simply replace placeholders for existing envvars with their current value as each var is processed.