File tree 1 file changed +6
-2
lines changed
modules/runners/templates
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -54,16 +54,20 @@ if [ -z "$run_as" ]; then
54
54
run_as=" ec2-user"
55
55
fi
56
56
57
+ if [[ " $run_as " == " root" ]]; then
58
+ export RUNNER_ALLOW_RUNASROOT=1
59
+ fi
60
+
57
61
echo " Configure GH Runner as user $run_as "
58
- sudo -u " $run_as " -- ./config.sh --unattended --name " $instance_id " --work " _work" $$ {config}
62
+ sudo --preserve-env=RUNNER_ALLOW_RUNASROOT - u " $run_as " -- ./config.sh --unattended --name " $instance_id " --work " _work" $$ {config}
59
63
60
64
# # Start the runner
61
65
echo " Starting runner after $( awk ' {print int($1/3600)":"int(($1%3600)/60)":"int($1%60)}' /proc/uptime) "
62
66
echo " Starting the runner as user $run_as "
63
67
64
68
if [[ $agent_mode = " ephemeral" ]]; then
65
69
echo " Starting the runner in ephemeral mode"
66
- sudo -u " $run_as " -- ./run.sh
70
+ sudo --preserve-env=RUNNER_ALLOW_RUNASROOT - u " $run_as " -- ./run.sh
67
71
echo " Runner has finished"
68
72
69
73
echo " Stopping cloudwatch service"
You can’t perform that action at this time.
0 commit comments