Skip to content

Commit 9bf18bd

Browse files
authored
remove default ec2VolumeSize or ec2VolumeType settings (machulav#235)
Prior to this change, if a user did not specify ec2-volume-size or ec2-volume-type, we would send default values of "8" and "gp2" to the EC2 API. This was a problem if the user's AMI used a snapshot with other settings (like a bigger disk size, or another disk type like "io1"). AWS could fail to start the nodes if the AMI was incompatible with these defaults. Update the action to only send ec2VolumeSize or ec2VolumeType in the API call if the user has specified a value (not an empty string). With this change, we reintroduce the behavior prior to 8b37f73. This change preserves the default for ec2-device-name, since we need that default value in order to construct BlockDeviceSettings.
1 parent 7377de3 commit 9bf18bd

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

action.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ inputs:
102102
ec2-volume-size:
103103
description: >-
104104
EC2 volume size in GB.
105-
default: "8"
106105
required: false
107106
ec2-device-name:
108107
description: >-
@@ -112,7 +111,6 @@ inputs:
112111
ec2-volume-type:
113112
description: >-
114113
EC2 block device type.
115-
default: gp2
116114
required: false
117115

118116
outputs:

dist/index.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145081,16 +145081,19 @@ async function startEc2Instance(label, githubRegistrationToken) {
145081145081
IamInstanceProfile: { Name: config.input.iamRoleName },
145082145082
TagSpecifications: config.tagSpecifications,
145083145083
InstanceMarketOptions: buildMarketOptions(),
145084-
BlockDeviceMappings: [
145084+
};
145085+
145086+
if (config.input.ec2VolumeSize !== '' || config.input.ec2VolumeType !== '') {
145087+
params.BlockDeviceMappings = [
145085145088
{
145086145089
DeviceName: config.input.ec2DeviceName,
145087145090
Ebs: {
145088-
VolumeSize: config.input.ec2VolumeSize,
145089-
VolumeType: config.input.ec2VolumeType,
145091+
...(config.input.ec2VolumeSize !== '' && { VolumeSize: config.input.ec2VolumeSize }),
145092+
...(config.input.ec2VolumeType !== '' && { VolumeType: config.input.ec2VolumeType }),
145090145093
},
145091145094
},
145092-
],
145093-
};
145095+
];
145096+
}
145094145097

145095145098
if (config.input.blockDeviceMappings.length > 0) {
145096145099
params.BlockDeviceMappings = config.input.blockDeviceMappings;

src/aws.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,19 @@ async function startEc2Instance(label, githubRegistrationToken) {
7373
IamInstanceProfile: { Name: config.input.iamRoleName },
7474
TagSpecifications: config.tagSpecifications,
7575
InstanceMarketOptions: buildMarketOptions(),
76-
BlockDeviceMappings: [
76+
};
77+
78+
if (config.input.ec2VolumeSize !== '' || config.input.ec2VolumeType !== '') {
79+
params.BlockDeviceMappings = [
7780
{
7881
DeviceName: config.input.ec2DeviceName,
7982
Ebs: {
80-
VolumeSize: config.input.ec2VolumeSize,
81-
VolumeType: config.input.ec2VolumeType,
83+
...(config.input.ec2VolumeSize !== '' && { VolumeSize: config.input.ec2VolumeSize }),
84+
...(config.input.ec2VolumeType !== '' && { VolumeType: config.input.ec2VolumeType }),
8285
},
8386
},
84-
],
85-
};
87+
];
88+
}
8689

8790
if (config.input.blockDeviceMappings.length > 0) {
8891
params.BlockDeviceMappings = config.input.blockDeviceMappings;

0 commit comments

Comments
 (0)