Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ inputs:
description: >-
EC2 block device type.
required: false
key-name:
description: >-
Key to use for the created EC2 instance
required: false

outputs:
label:
Expand Down
10 changes: 8 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145021,7 +145021,9 @@ function buildUserDataScript(githubRegistrationToken, label) {
'#!/bin/bash',
'exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1',
`cd "${config.input.runnerHomeDir}"`,
`echo "${config.input.preRunnerScript}" > pre-runner-script.sh`,
`cat <<'EOF' > pre-runner-script.sh`,
config.input.preRunnerScript,
`EOF`,
'source pre-runner-script.sh',
'export RUNNER_ALLOW_RUNASROOT=1',
`./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`,
Expand All @@ -145031,7 +145033,9 @@ function buildUserDataScript(githubRegistrationToken, label) {
'#!/bin/bash',
'exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1',
'mkdir actions-runner && cd actions-runner',
`echo "${config.input.preRunnerScript}" > pre-runner-script.sh`,
`cat <<'EOF' > pre-runner-script.sh`,
config.input.preRunnerScript,
`EOF`,
'source pre-runner-script.sh',
'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}',
'curl -O -L https://github.com/actions/runner/releases/download/v2.313.0/actions-runner-linux-${RUNNER_ARCH}-2.313.0.tar.gz',
Expand Down Expand Up @@ -145083,6 +145087,7 @@ async function createEc2InstanceWithParams(imageId, subnetId, securityGroupId, l
IamInstanceProfile: config.input.iamRoleName ? { Name: config.input.iamRoleName } : undefined,
TagSpecifications: config.tagSpecifications,
InstanceMarketOptions: buildMarketOptions(),
KeyName: config.input.keyName,
};

if (config.input.ec2VolumeSize !== '' || config.input.ec2VolumeType !== '') {
Expand Down Expand Up @@ -145235,6 +145240,7 @@ class Config {
ec2VolumeType: core.getInput('ec2-volume-type'),
blockDeviceMappings: JSON.parse(core.getInput('block-device-mappings') || '[]'),
availabilityZonesConfig: core.getInput('availability-zones-config'),
keyName: core.getInput('key-name'),
};

// Get the AWS_REGION environment variable
Expand Down
9 changes: 7 additions & 2 deletions src/aws.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ function buildUserDataScript(githubRegistrationToken, label) {
'#!/bin/bash',
'exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1',
`cd "${config.input.runnerHomeDir}"`,
`echo "${config.input.preRunnerScript}" > pre-runner-script.sh`,
`cat <<'EOF' > pre-runner-script.sh`,
config.input.preRunnerScript,
`EOF`,
'source pre-runner-script.sh',
'export RUNNER_ALLOW_RUNASROOT=1',
`./config.sh --url https://github.com/${config.githubContext.owner}/${config.githubContext.repo} --token ${githubRegistrationToken} --labels ${label}`,
Expand All @@ -23,7 +25,9 @@ function buildUserDataScript(githubRegistrationToken, label) {
'#!/bin/bash',
'exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1',
'mkdir actions-runner && cd actions-runner',
`echo "${config.input.preRunnerScript}" > pre-runner-script.sh`,
`cat <<'EOF' > pre-runner-script.sh`,
config.input.preRunnerScript,
`EOF`,
'source pre-runner-script.sh',
'case $(uname -m) in aarch64) ARCH="arm64" ;; amd64|x86_64) ARCH="x64" ;; esac && export RUNNER_ARCH=${ARCH}',
'curl -O -L https://github.com/actions/runner/releases/download/v2.313.0/actions-runner-linux-${RUNNER_ARCH}-2.313.0.tar.gz',
Expand Down Expand Up @@ -75,6 +79,7 @@ async function createEc2InstanceWithParams(imageId, subnetId, securityGroupId, l
IamInstanceProfile: config.input.iamRoleName ? { Name: config.input.iamRoleName } : undefined,
TagSpecifications: config.tagSpecifications,
InstanceMarketOptions: buildMarketOptions(),
KeyName: config.input.keyName,
};

if (config.input.ec2VolumeSize !== '' || config.input.ec2VolumeType !== '') {
Expand Down
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Config {
ec2VolumeType: core.getInput('ec2-volume-type'),
blockDeviceMappings: JSON.parse(core.getInput('block-device-mappings') || '[]'),
availabilityZonesConfig: core.getInput('availability-zones-config'),
keyName: core.getInput('key-name'),
};

// Get the AWS_REGION environment variable
Expand Down