diff --git a/.env.example b/.env.example
index 2db35299..0aab5b1a 100644
--- a/.env.example
+++ b/.env.example
@@ -19,3 +19,5 @@ INPUT_SECURITY-GROUP-ID=
INPUT_LABEL=
INPUT_EC2-INSTANCE-ID=
GITHUB_REPOSITORY=
+INPUT_EC2-VOLUME-SIZE=
+INPUT_EC2-DEVICE-NAME=
diff --git a/README.md b/README.md
index 19748696..6a037156 100644
--- a/README.md
+++ b/README.md
@@ -202,21 +202,23 @@ Now you're ready to go!
### Inputs
-| Name | Required | Description |
-| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `mode` | Always required. | Specify here which mode you want to use:
- `start` - to start a new runner;
- `stop` - to stop the previously created runner. |
-| `github-token` | Always required. | GitHub Personal Access Token with the `repo` scope assigned. |
-| `ec2-image-id` | Required if you use the `start` mode. | EC2 Image Id (AMI).
The new runner will be launched from this image.
The action is compatible with Amazon Linux 2 images. |
-| `ec2-instance-type` | Required if you use the `start` mode. | EC2 Instance Type. |
-| `subnet-id` | Required if you use the `start` mode. | VPC Subnet Id.
The subnet should belong to the same VPC as the specified security group. |
-| `security-group-id` | Required if you use the `start` mode. | EC2 Security Group Id.
The security group should belong to the same VPC as the specified subnet.
Only the outbound traffic for port 443 should be allowed. No inbound traffic is required. |
-| `label` | Required if you use the `stop` mode. | Name of the unique label assigned to the runner.
The label is provided by the output of the action in the `start` mode.
The label is used to remove the runner from GitHub when the runner is not needed anymore. |
-| `ec2-instance-id` | Required if you use the `stop` mode. | EC2 Instance Id of the created runner.
The id is provided by the output of the action in the `start` mode.
The id is used to terminate the EC2 instance when the runner is not needed anymore. |
-| `iam-role-name` | Optional. Used only with the `start` mode. | IAM role name to attach to the created EC2 runner.
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.
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.
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| -| `market-type` | Optional. Used only with the `start` mode. | The only valid option is `spot`. If `spot` is specified, a Spot instance will be requested. If left unspecified, an on-demand instance will be provisioned. | +| Name | Required | Description | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------------------------------------------ |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `mode` | Always required. | Specify here which mode you want to use:
with:
mode: start
...
pre-runner-script: \|
sudo yum update -y && \
sudo yum install docker git libicu -y
sudo systemctl enable docker
- name: Start EC2 runner| +| `market-type` | Optional. Used only with the `start` mode. | The only valid option is `spot`. If `spot` is specified, a Spot instance will be requested. If left unspecified, an on-demand instance will be provisioned. | +| `ec2-volume-size` | Optional. | Defines the size of the EC2 Volume in GB, will use the AWS default of 8 GB if not provided. | +| `ec2-device-name` | Optional. | Defines the device name used for the root volume. | ### Environment variables diff --git a/action.yml b/action.yml index d3f1d9f5..b301431e 100644 --- a/action.yml +++ b/action.yml @@ -74,6 +74,16 @@ inputs: Specifies the market (purchasing) option for the instance: - 'spot' - Use a spot instance required: false + ec2-volume-size: + description: >- + EC2 volume size in GB. + default: "8" + required: false + ec2-device-name: + description: >- + EC2 block device name. + default: /dev/sda1 + required: false outputs: label: diff --git a/dist/index.js b/dist/index.js index fbaaa406..344091c2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -148426,6 +148426,14 @@ async function startEc2Instance(label, githubRegistrationToken) { IamInstanceProfile: { Name: config.input.iamRoleName }, TagSpecifications: config.tagSpecifications, InstanceMarketOptions: buildMarketOptions(), + BlockDeviceMappings: [ + { + DeviceName: config.input.ec2DeviceName, + Ebs: { + VolumeSize: config.input.ec2VolumeSize, + }, + }, + ], }; try { @@ -148513,6 +148521,8 @@ class Config { runnerHomeDir: core.getInput('runner-home-dir'), preRunnerScript: core.getInput('pre-runner-script'), marketType: core.getInput('market-type'), + ec2VolumeSize: core.getInput('ec2-volume-size'), + ec2DeviceName: core.getInput('ec2-device-name'), }; const tags = JSON.parse(core.getInput('aws-resource-tags')); diff --git a/src/aws.js b/src/aws.js index ac83394a..552d22af 100644 --- a/src/aws.js +++ b/src/aws.js @@ -62,6 +62,14 @@ async function startEc2Instance(label, githubRegistrationToken) { IamInstanceProfile: { Name: config.input.iamRoleName }, TagSpecifications: config.tagSpecifications, InstanceMarketOptions: buildMarketOptions(), + BlockDeviceMappings: [ + { + DeviceName: config.input.ec2DeviceName, + Ebs: { + VolumeSize: config.input.ec2VolumeSize, + }, + }, + ], }; try { diff --git a/src/config.js b/src/config.js index b8bbc4fc..8a886654 100644 --- a/src/config.js +++ b/src/config.js @@ -16,6 +16,8 @@ class Config { runnerHomeDir: core.getInput('runner-home-dir'), preRunnerScript: core.getInput('pre-runner-script'), marketType: core.getInput('market-type'), + ec2VolumeSize: core.getInput('ec2-volume-size'), + ec2DeviceName: core.getInput('ec2-device-name'), }; const tags = JSON.parse(core.getInput('aws-resource-tags'));
with:
mode: start
...
pre-runner-script: \|
sudo yum update -y && \
sudo yum install docker git libicu -y
sudo systemctl enable docker