@@ -10,13 +10,15 @@ function buildUserDataScript(githubRegistrationToken, label) {
10
10
// to be pre-installed in the AMI, so we simply cd into that directory and then start the runner
11
11
userData = [
12
12
'#!/bin/bash' ,
13
+ 'exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1' ,
13
14
`cd "${ config . input . runnerHomeDir } "` ,
14
15
'export RUNNER_ALLOW_RUNASROOT=1' ,
15
16
`./config.sh --url https://github.com/${ config . githubContext . owner } /${ config . githubContext . repo } --token ${ githubRegistrationToken } --labels ${ label } ` ,
16
17
] ;
17
18
} else {
18
19
userData = [
19
20
'#!/bin/bash' ,
21
+ 'exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1' ,
20
22
'mkdir actions-runner && cd actions-runner' ,
21
23
'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}' ,
22
24
'curl -O -L https://github.com/actions/runner/releases/download/v2.299.1/actions-runner-linux-${RUNNER_ARCH}-2.299.1.tar.gz' ,
@@ -25,11 +27,14 @@ function buildUserDataScript(githubRegistrationToken, label) {
25
27
`./config.sh --url https://github.com/${ config . githubContext . owner } /${ config . githubContext . repo } --token ${ githubRegistrationToken } --labels ${ label } ` ,
26
28
] ;
27
29
}
30
+ if ( config . input . runAsUser ) {
31
+ userData . push ( `chown -R ${ config . input . runAsUser } ${ config . input . runnerHomeDir } ` ) ;
32
+ }
28
33
if ( config . input . runAsService ) {
29
- userData . push ( ' ./svc.sh install' ) ;
34
+ userData . push ( ` ./svc.sh install ${ config . input . runAsUser || '' } ` ) ;
30
35
userData . push ( './svc.sh start' ) ;
31
36
} else {
32
- userData . push ( ' ./run.sh' ) ;
37
+ userData . push ( ` ${ config . input . runAsUser ? `su ${ config . input . runAsUser } -c` : '' } ./run.sh` ) ;
33
38
}
34
39
return userData ;
35
40
}
0 commit comments