Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for custom root volume storage size #174

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ Now you're ready to go!
| `aws-resource-tags` | Optional. Used only with the `start` mode. | Specifies tags to add to the EC2 instance and any attached storage. <br><br> This field is a stringified JSON array of tag objects, each containing a `Key` and `Value` field (see example below). <br><br> Setting this requires additional AWS permissions for the role launching the instance (see above). |
| `runner-home-dir` | Optional. Used only with the `start` mode. | Specifies a directory where pre-installed actions-runner software and scripts are located.<br><br> |
| `pre-runner-script` | Optional. Used only with the `start` mode. | Specifies bash commands to run before the runner starts. It's useful for installing dependencies with apt-get, yum, dnf, etc. For example:<pre> - name: Start EC2 runner<br> with:<br> mode: start<br> ...<br> pre-runner-script: \|<br> sudo yum update -y && \ <br> sudo yum install docker git libicu -y<br> sudo systemctl enable docker</pre>
| `storage-size` | Optional. Used only with the `start` mode. | Specifies the root volume size in GB. |
<br><br> |

### Environment variables
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ inputs:
description: >-
Specifies bash commands to run before the runner starts. It's useful for installing dependencies with apt-get, yum, dnf, etc.
required: false
storage-size:
description: >-
Specifies the root volume size in GB.
required: false

outputs:
label:
Expand Down
14 changes: 14 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62837,6 +62837,18 @@ async function startEc2Instance(label, githubRegistrationToken) {

const userData = buildUserDataScript(githubRegistrationToken, label);

const blockDeviceMappings = config.input.storageSize
? [
{
DeviceName: '/dev/sda1',
Ebs: {
DeleteOnTermination: true,
VolumeSize: parseInt(config.input.storageSize),
},
},
]
: undefined;

const params = {
ImageId: config.input.ec2ImageId,
InstanceType: config.input.ec2InstanceType,
Expand All @@ -62847,6 +62859,7 @@ async function startEc2Instance(label, githubRegistrationToken) {
SecurityGroupIds: [config.input.securityGroupId],
IamInstanceProfile: { Name: config.input.iamRoleName },
TagSpecifications: config.tagSpecifications,
BlockDeviceMappings: blockDeviceMappings,
};

try {
Expand Down Expand Up @@ -62923,6 +62936,7 @@ class Config {
iamRoleName: core.getInput('iam-role-name'),
runnerHomeDir: core.getInput('runner-home-dir'),
preRunnerScript: core.getInput('pre-runner-script'),
storageSize: core.getInput('storage-size'),
};

const tags = JSON.parse(core.getInput('aws-resource-tags'));
Expand Down
13 changes: 13 additions & 0 deletions src/aws.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ async function startEc2Instance(label, githubRegistrationToken) {

const userData = buildUserDataScript(githubRegistrationToken, label);

const blockDeviceMappings = config.input.storageSize
? [
{
DeviceName: '/dev/sda1',
Ebs: {
DeleteOnTermination: true,
VolumeSize: parseInt(config.input.storageSize),
},
},
]
: undefined;

const params = {
ImageId: config.input.ec2ImageId,
InstanceType: config.input.ec2InstanceType,
Expand All @@ -47,6 +59,7 @@ async function startEc2Instance(label, githubRegistrationToken) {
SecurityGroupIds: [config.input.securityGroupId],
IamInstanceProfile: { Name: config.input.iamRoleName },
TagSpecifications: config.tagSpecifications,
BlockDeviceMappings: blockDeviceMappings,
};

try {
Expand Down
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Config {
iamRoleName: core.getInput('iam-role-name'),
runnerHomeDir: core.getInput('runner-home-dir'),
preRunnerScript: core.getInput('pre-runner-script'),
storageSize: core.getInput('storage-size'),
};

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