Skip to content

Commit 3d2feb3

Browse files
tonyhutterdcarley
authored andcommitted
Add 'key-name' option
Add one new option to workflow file: key-name: Specifies SSH key-pair name to assign to an instance. This is useful for SSHing into an instance for debugging. Signed-off-by: Tony Hutter <hutter2@llnl.gov> Modified cherry-pick of: - machulav#156 Because `block-device-mappings` was merged separately in: - machulav#229
1 parent a2093ba commit 3d2feb3

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ Now you're ready to go!
224224
| `ec2-volume-size` | Optional | Defines the size of the EC2 Volume in GB, will use the AWS default of 8 GB if not provided. |
225225
| `ec2-device-name` | Optional | Defines the device name used for the root volume. |
226226
| `ec2-volume-type` | Optional | Defines the device type used for the root volume. |
227+
| `key-name` | Optional | Assign SSH key-pair name to an instance. This can be useful for SSHing into an instance for debugging. |
227228

228229
### Environment variables
229230

@@ -286,6 +287,7 @@ jobs:
286287
[
287288
{"DeviceName": "/dev/sda1", "Ebs": {"VolumeSize": 100, "VolumeType": "gp3"}}
288289
]
290+
key-name: my-ssh-key # optional
289291
do-the-job:
290292
name: Do the job on the runner
291293
needs: start-runner # required to start the main job when the runner is ready

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ inputs:
135135
Example: '["git", "docker.io", "nodejs"]'
136136
required: false
137137
default: '[]'
138+
key-name:
139+
description: >-
140+
Assign SSH key-pair name to an instance. This can be useful for SSHing into an instance for debugging.
141+
required: false
142+
138143
outputs:
139144
label:
140145
description: >-

src/aws.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ async function createEc2InstanceWithParams(imageId, subnetId, securityGroupId, l
126126
TagSpecifications: config.tagSpecifications,
127127
InstanceMarketOptions: buildMarketOptions(),
128128
MetadataOptions: Object.keys(config.input.metadataOptions).length > 0 ? config.input.metadataOptions : undefined,
129+
KeyName: config.input.keyName,
129130
};
130131

131132
if (config.input.ec2VolumeSize !== '' || config.input.ec2VolumeType !== '') {

src/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class Config {
2828
availabilityZonesConfig: core.getInput('availability-zones-config'),
2929
metadataOptions: JSON.parse(core.getInput('metadata-options') || '{}'),
3030
packages: JSON.parse(core.getInput('packages') || '[]'),
31+
keyName: core.getInput('key-name'),
3132
};
3233

3334
// Get the AWS_REGION environment variable

0 commit comments

Comments
 (0)