diff --git a/README.md b/README.md
index e3b4e890..ceca1557 100644
--- a/README.md
+++ b/README.md
@@ -206,7 +206,9 @@ 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. 
 This field is a stringified JSON array of tag objects, each containing a `Key` and `Value` field (see example below). 
 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.
 |
 | `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:
- name: Start EC2 runner-
with:
mode: start
...
pre-runner-script: \|
sudo yum update -y && \
sudo yum install docker git libicu -y
sudo systemctl enable docker
block-device-mapper: \|| ### Environment variables @@ -263,6 +265,12 @@ jobs: {"Key": "Name", "Value": "ec2-github-runner"}, {"Key": "GitHubRepository", "Value": "${{ github.repository }}"} ] + key-name: my-ssh-key # optional + block-device-mapper: | # optional + [ + {"DeviceName" : "/dev/sda1", "Ebs" : { "VolumeType": "gp2", "VolumeSize": 34 }}, + {"DeviceName" : "/dev/sdb", "VirtualName": "ephemeral0" } + ] do-the-job: name: Do the job on the runner needs: start-runner # required to start the main job when the runner is ready diff --git a/action.yml b/action.yml index 09fa9591..218783e4 100644 --- a/action.yml +++ b/action.yml @@ -69,6 +69,15 @@ 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 + block-device-mapping: + description: >- + JSON string of EC2 BlockDeviceMapping (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html). + required: false + default: '[]' + key-name: + description: >- + Assign SSH key-pair name to an instance. This can be useful for SSHing into an instance for debugging. + required: false outputs: label: diff --git a/dist/index.js b/dist/index.js index 409180d4..43706a3d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -62847,6 +62847,8 @@ async function startEc2Instance(label, githubRegistrationToken) { SecurityGroupIds: [config.input.securityGroupId], IamInstanceProfile: { Name: config.input.iamRoleName }, TagSpecifications: config.tagSpecifications, + BlockDeviceMappings: config.input.blockDeviceMappings, + KeyName: config.input.keyName, }; try { @@ -62923,6 +62925,8 @@ class Config { iamRoleName: core.getInput('iam-role-name'), runnerHomeDir: core.getInput('runner-home-dir'), preRunnerScript: core.getInput('pre-runner-script'), + blockDeviceMappings: JSON.parse(core.getInput('block-device-mapping')), + keyName: core.getInput('key-name'), }; const tags = JSON.parse(core.getInput('aws-resource-tags')); diff --git a/src/aws.js b/src/aws.js index bcf53646..89f97eca 100644 --- a/src/aws.js +++ b/src/aws.js @@ -47,6 +47,8 @@ async function startEc2Instance(label, githubRegistrationToken) { SecurityGroupIds: [config.input.securityGroupId], IamInstanceProfile: { Name: config.input.iamRoleName }, TagSpecifications: config.tagSpecifications, + BlockDeviceMappings: config.input.blockDeviceMappings, + KeyName: config.input.keyName, }; try { diff --git a/src/config.js b/src/config.js index 1100f51e..cb636a62 100644 --- a/src/config.js +++ b/src/config.js @@ -15,6 +15,8 @@ class Config { iamRoleName: core.getInput('iam-role-name'), runnerHomeDir: core.getInput('runner-home-dir'), preRunnerScript: core.getInput('pre-runner-script'), + blockDeviceMappings: JSON.parse(core.getInput('block-device-mapping')), + keyName: core.getInput('key-name'), }; const tags = JSON.parse(core.getInput('aws-resource-tags'));
[
{"DeviceName" : "/dev/sda1", "Ebs" : { "VolumeType": "gp2", "VolumeSize": 34 }},
{"DeviceName" : "/dev/sdb", "VirtualName": "ephemeral0" }
] +