feat: Have sudo run the user's shell when calling config.sh from start-runner.sh #3768
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We ran into a really interesting issue where we want the
$PATH
from the$run_as
user's shell. Mostly things that are configured in the bash rc files, like~/.local/bin
, which aren't present in the base system path. I couldn't find a better way to do this. It appears the.path
file is written by theconfig.sh
script, and is then locked into place. I think that happens here - https://github.com/actions/runner/blob/72559572f64f40554d43cfa04e4128725dc2274b/src/Misc/layoutroot/env.sh#L37. We're currently running from AMIs built with this patch.The
-i
flag, according to sudo, willRun the shell specified by the target user's password database entry as a login shell. ...
. Because it enters the shell, it resets PWD back to the home folder of the user, hence setting the full path of theconfig.sh
script when calling it.I can't think of any negative consequences to this, but it's definitely likely to cause runners to have a different path than they do now.