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

Feature/add optional volume size #189

Open
wants to merge 6 commits 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 .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ INPUT_SUBNET-ID=
INPUT_SECURITY-GROUP-ID=
INPUT_LABEL=
INPUT_EC2-INSTANCE-ID=
INPUT_EC2-VOLUME-SIZE=
GITHUB_REPOSITORY=
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ Now you're ready to go!
| `iam-role-name` | Optional. Used only with the `start` mode. | IAM role name to attach to the created EC2 runner. <br><br> This allows the runner to have permissions to run additional actions within the AWS account, without having to manage additional GitHub secrets and AWS users. <br><br> Setting this requires additional AWS permissions for the role launching the instance (see above). |
| `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>
| `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> |
| `ec2-volume-size` | Optional. | Defines the size of the EC2 Volume in GB, will use the AWS default of 16 GB if not provided.
<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
ec2-volume-size:
description: >-
Defines the size of the EC2 Volume in GB, will use the AWS default of 16 GB if not provided.
required: false

outputs:
label:
Expand Down
11 changes: 11 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65301,6 +65301,16 @@ async function startEc2Instance(label, githubRegistrationToken) {
const userData = buildUserDataScript(githubRegistrationToken, label);

const params = {
...config.input.ec2VolumeSize && {
BlockDeviceMappings: [
{
DeviceName: "/dev/sda1",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to also allow the user to specify this. The image I use has the root device name of /dev/xvda

Ebs: {
VolumeSize: config.input.ec2VolumeSize
}
}
]
},
ImageId: config.input.ec2ImageId,
InstanceType: config.input.ec2InstanceType,
MinCount: 1,
Expand Down Expand Up @@ -65386,6 +65396,7 @@ class Config {
iamRoleName: core.getInput('iam-role-name'),
runnerHomeDir: core.getInput('runner-home-dir'),
preRunnerScript: core.getInput('pre-runner-script'),
ec2VolumeSize: core.getInput('ec2-volume-size')
};

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