@@ -11,6 +11,7 @@ function buildUserDataScript(githubRegistrationToken, label) {
1111 // to be pre-installed in the AMI, so we simply cd into that directory and then start the runner
1212 userData = [
1313 '#!/bin/bash' ,
14+ 'exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1' ,
1415 `cd "${ config . input . runnerHomeDir } "` ,
1516 `echo "${ config . input . preRunnerScript } " > pre-runner-script.sh` ,
1617 'source pre-runner-script.sh' ,
@@ -20,6 +21,7 @@ function buildUserDataScript(githubRegistrationToken, label) {
2021 } else {
2122 userData = [
2223 '#!/bin/bash' ,
24+ 'exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1' ,
2325 'mkdir actions-runner && cd actions-runner' ,
2426 `echo "${ config . input . preRunnerScript } " > pre-runner-script.sh` ,
2527 'source pre-runner-script.sh' ,
@@ -30,11 +32,14 @@ function buildUserDataScript(githubRegistrationToken, label) {
3032 `./config.sh --url https://github.com/${ config . githubContext . owner } /${ config . githubContext . repo } --token ${ githubRegistrationToken } --labels ${ label } ` ,
3133 ] ;
3234 }
35+ if ( config . input . runAsUser ) {
36+ userData . push ( `chown -R ${ config . input . runAsUser } ${ config . input . runnerHomeDir } ` ) ;
37+ }
3338 if ( config . input . runAsService ) {
34- userData . push ( ' ./svc.sh install' ) ;
39+ userData . push ( ` ./svc.sh install ${ config . input . runAsUser || '' } ` ) ;
3540 userData . push ( './svc.sh start' ) ;
3641 } else {
37- userData . push ( ' ./run.sh' ) ;
42+ userData . push ( ` ${ config . input . runAsUser ? `su ${ config . input . runAsUser } -c` : '' } ./run.sh` ) ;
3843 }
3944 return userData ;
4045}
0 commit comments