Skip to content

Commit 681180b

Browse files
author
Paul Ashton
committed
Add root-storage-gb parameter
1 parent d675fc0 commit 681180b

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

src/aws.js

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -131,32 +131,20 @@ async function startEc2Instance(label, githubRegistrationToken) {
131131
}
132132
}
133133

134-
const ec2 = new EC2Client({region: process.env.AWS_REGION});
134+
// add root storage size if its been set
135+
if (config.input.rootStorageGB) {
136+
params["BlockDeviceMappings"] = [
137+
{
138+
DeviceName: "/dev/sda1",
139+
"Ebs": { "VolumeSize": config.input.rootStorageGB }
140+
}
141+
]
142+
}
135143

144+
const ec2 = new EC2Client({region: process.env.AWS_REGION});
136145
const command = new RunInstancesCommand(params);
137-
138-
console.log("sendstart")
139-
const response = await ec2.send(command); //, (err, data) => {
140-
console.log("response")
141-
console.log(response)
142-
console.log("endresponse")
143-
console.log(response.Instances.map(x => x.InstanceId));
146+
const response = await ec2.send(command);
144147
return response.Instances.map(x => x.InstanceId);
145-
146-
// const instanceIds = await sendstart(runInstancesCommand)
147-
// return instanceIds
148-
// await ec2.send(runInstancesCommand, (err, data) => {
149-
// if (err) {
150-
// console.log(err, err.stack);
151-
// core.error(`AWS EC2 instance failed to start - error: ${err}`)
152-
// throw err;
153-
// } else {
154-
// const ec2InstanceIds = data.Instances.map(x => x.InstanceId); //[0].InstanceId; pass all instances instead of just first id
155-
// core.info(`AWS EC2 instance(s) ${ec2InstanceIds} is started`);
156-
// return ec2InstanceIds;
157-
// }
158-
// });
159-
// console.log("aftersend")
160148
}
161149

162150
async function terminateEc2Instance() {

src/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class Config {
1818
numRunners: core.getInput('num-runners'),
1919
numInstances: core.getInput('num-instances'),
2020
useSpotInstances: core.getInput('use-spot-instances'),
21+
rootStorageGB: core.getInput('root-storage-gb'),
2122
};
2223

2324
const tags = JSON.parse(core.getInput('aws-resource-tags'));

0 commit comments

Comments
 (0)