Skip to content

Commit af946fe

Browse files
author
Paul Ashton
committed
refactor
1 parent 63f9121 commit af946fe

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

src/aws.js

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,16 @@ async function getImageId(imageNameMatch) {
8484
}
8585
}
8686

87-
async function sendstart(command) {
88-
const ec2 = new EC2Client({region: process.env.AWS_REGION});
89-
90-
console.log("sendstart")
91-
const response = await ec2.send(command); //, (err, data) => {
92-
console.log("response")
93-
console.log(response)
94-
console.log("endresponse")
87+
// async function sendstart(command) {
88+
// const ec2 = new EC2Client({region: process.env.AWS_REGION});
89+
90+
// console.log("sendstart")
91+
// const response = await ec2.send(command); //, (err, data) => {
92+
// console.log("response")
93+
// console.log(response)
94+
// console.log("endresponse")
95+
// console.log(response.Instances.map(x => x.InstanceId));
96+
// return response.Instances.map(x => x.InstanceId);
9597
// if (err) {
9698
// console.log(err, err.stack);
9799
// core.error(`Error: ${err}`)
@@ -102,7 +104,7 @@ async function sendstart(command) {
102104
// return ec2InstanceIds;
103105
// }
104106
// });
105-
}
107+
//}
106108

107109
async function startEc2Instance(label, githubRegistrationToken) {
108110
const userData = buildUserDataScript(githubRegistrationToken, label);
@@ -129,13 +131,20 @@ async function startEc2Instance(label, githubRegistrationToken) {
129131
}
130132
}
131133

132-
//const ec2 = new EC2Client({region: process.env.AWS_REGION});
134+
const ec2 = new EC2Client({region: process.env.AWS_REGION});
135+
136+
const command = new RunInstancesCommand(params);
133137

134-
const runInstancesCommand = new RunInstancesCommand(params);
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));
144+
return response.Instances.map(x => x.InstanceId);
135145

136-
//console.log("beforesend")
137-
const instanceIds = await sendstart(runInstancesCommand)
138-
return instanceIds
146+
// const instanceIds = await sendstart(runInstancesCommand)
147+
// return instanceIds
139148
// await ec2.send(runInstancesCommand, (err, data) => {
140149
// if (err) {
141150
// console.log(err, err.stack);

0 commit comments

Comments
 (0)