Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e362c4f

Browse files
committedDec 15, 2023
Add option for custom root volume storage size
1 parent 2c4d1dc commit e362c4f

File tree

5 files changed

+33
-0
lines changed

5 files changed

+33
-0
lines changed
 

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ Now you're ready to go!
206206
| `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). |
207207
| `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> |
208208
| `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>
209+
| `storage-size` | Optional. Used only with the `start` mode. | Specifies the root volume size in GB. |
209210
<br><br> |
210211

211212
### Environment variables

‎action.yml

+4
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ inputs:
6969
description: >-
7070
Specifies bash commands to run before the runner starts. It's useful for installing dependencies with apt-get, yum, dnf, etc.
7171
required: false
72+
storage-size:
73+
description: >-
74+
Specifies the root volume size in GB.
75+
required: false
7276

7377
outputs:
7478
label:

‎dist/index.js

+14
Original file line numberDiff line numberDiff line change
@@ -62837,6 +62837,18 @@ async function startEc2Instance(label, githubRegistrationToken) {
6283762837

6283862838
const userData = buildUserDataScript(githubRegistrationToken, label);
6283962839

62840+
const blockDeviceMappings = config.input.storageSize
62841+
? [
62842+
{
62843+
DeviceName: '/dev/sda1',
62844+
Ebs: {
62845+
DeleteOnTermination: true,
62846+
VolumeSize: parseInt(config.input.storageSize),
62847+
},
62848+
},
62849+
]
62850+
: undefined;
62851+
6284062852
const params = {
6284162853
ImageId: config.input.ec2ImageId,
6284262854
InstanceType: config.input.ec2InstanceType,
@@ -62847,6 +62859,7 @@ async function startEc2Instance(label, githubRegistrationToken) {
6284762859
SecurityGroupIds: [config.input.securityGroupId],
6284862860
IamInstanceProfile: { Name: config.input.iamRoleName },
6284962861
TagSpecifications: config.tagSpecifications,
62862+
BlockDeviceMappings: blockDeviceMappings,
6285062863
};
6285162864

6285262865
try {
@@ -62923,6 +62936,7 @@ class Config {
6292362936
iamRoleName: core.getInput('iam-role-name'),
6292462937
runnerHomeDir: core.getInput('runner-home-dir'),
6292562938
preRunnerScript: core.getInput('pre-runner-script'),
62939+
storageSize: core.getInput('storage-size'),
6292662940
};
6292762941

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

‎src/aws.js

+13
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ async function startEc2Instance(label, githubRegistrationToken) {
3737

3838
const userData = buildUserDataScript(githubRegistrationToken, label);
3939

40+
const blockDeviceMappings = config.input.storageSize
41+
? [
42+
{
43+
DeviceName: '/dev/sda1',
44+
Ebs: {
45+
DeleteOnTermination: true,
46+
VolumeSize: parseInt(config.input.storageSize),
47+
},
48+
},
49+
]
50+
: undefined;
51+
4052
const params = {
4153
ImageId: config.input.ec2ImageId,
4254
InstanceType: config.input.ec2InstanceType,
@@ -47,6 +59,7 @@ async function startEc2Instance(label, githubRegistrationToken) {
4759
SecurityGroupIds: [config.input.securityGroupId],
4860
IamInstanceProfile: { Name: config.input.iamRoleName },
4961
TagSpecifications: config.tagSpecifications,
62+
BlockDeviceMappings: blockDeviceMappings,
5063
};
5164

5265
try {

‎src/config.js

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Config {
1515
iamRoleName: core.getInput('iam-role-name'),
1616
runnerHomeDir: core.getInput('runner-home-dir'),
1717
preRunnerScript: core.getInput('pre-runner-script'),
18+
storageSize: core.getInput('storage-size'),
1819
};
1920

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

0 commit comments

Comments
 (0)
Please sign in to comment.