Skip to content

Commit 3740c01

Browse files
author
GitHub Actions
committed
Update dist
1 parent 17e4c97 commit 3740c01

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

dist/index.js

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55133,22 +55133,38 @@ const AWS = __webpack_require__(71786);
5513355133
const core = __webpack_require__(42186);
5513455134
const config = __webpack_require__(34570);
5513555135

55136+
// User data scripts are run as the root user
55137+
function buildUserDataScript(githubRegistrationToken, label) {
55138+
if (config.input.runnerHomeDir) {
55139+
// If runner home directory is specified, we expect the actions-runner software (and dependencies)
55140+
// to be pre-installed in the AMI, so we simply cd into that directory and then start the runner
55141+
return [
55142+
'#!/bin/bash',
55143+
`cd "${config.input.runnerHomeDir}"`,
55144+
'export RUNNER_ALLOW_RUNASROOT=1',
55145+
'export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1',
55146+
`./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`,
55147+
'./run.sh',
55148+
];
55149+
} else {
55150+
return [
55151+
'#!/bin/bash',
55152+
'mkdir actions-runner && cd actions-runner',
55153+
'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}',
55154+
'curl -O -L https://github.com/actions/runner/releases/download/v2.278.0/actions-runner-linux-${RUNNER_ARCH}-2.278.0.tar.gz',
55155+
'tar xzf ./actions-runner-linux-${RUNNER_ARCH}-2.278.0.tar.gz',
55156+
'export RUNNER_ALLOW_RUNASROOT=1',
55157+
'export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1',
55158+
`./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`,
55159+
'./run.sh',
55160+
];
55161+
}
55162+
}
55163+
5513655164
async function startEc2Instance(label, githubRegistrationToken) {
5513755165
const ec2 = new AWS.EC2();
5513855166

55139-
// User data scripts are run as the root user.
55140-
// Docker and git are necessary for GitHub runner and should be pre-installed on the AMI.
55141-
const userData = [
55142-
'#!/bin/bash',
55143-
'mkdir actions-runner && cd actions-runner',
55144-
'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}',
55145-
'curl -O -L https://github.com/actions/runner/releases/download/v2.278.0/actions-runner-linux-${RUNNER_ARCH}-2.278.0.tar.gz',
55146-
'tar xzf ./actions-runner-linux-${RUNNER_ARCH}-2.278.0.tar.gz',
55147-
'export RUNNER_ALLOW_RUNASROOT=1',
55148-
'export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1',
55149-
`./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`,
55150-
'./run.sh',
55151-
];
55167+
const userData = buildUserDataScript(githubRegistrationToken, label);
5515255168

5515355169
const params = {
5515455170
ImageId: config.input.ec2ImageId,
@@ -55234,6 +55250,7 @@ class Config {
5523455250
label: core.getInput('label'),
5523555251
ec2InstanceId: core.getInput('ec2-instance-id'),
5523655252
iamRoleName: core.getInput('iam-role-name'),
55253+
runnerHomeDir: core.getInput('runner-home-dir'),
5523755254
};
5523855255

5523955256
const tags = JSON.parse(core.getInput('aws-resource-tags'));

0 commit comments

Comments
 (0)