@@ -264,6 +264,7 @@ async function run() {
264
264
const cluster = core.getInput('cluster', { required: false });
265
265
const count = core.getInput('count', { required: true });
266
266
const startedBy = core.getInput('started-by', { required: false }) || agent;
267
+ const subnets = core.getInput('subnets', { required: true });
267
268
const waitForFinish = core.getInput('wait-for-finish', { required: false }) || false;
268
269
let waitForMinutes = parseInt(core.getInput('wait-for-minutes', { required: false })) || 30;
269
270
if (waitForMinutes > MAX_WAIT_MINUTES) {
@@ -296,14 +297,36 @@ async function run() {
296
297
cluster: clusterName,
297
298
taskDefinition: taskDefArn,
298
299
count: count,
299
- startedBy: startedBy
300
+ startedBy: startedBy,
301
+ networkConfiguration: {
302
+ awsvpcConfiguration: {
303
+ subnets: subnets
304
+ },
305
+ },
306
+ })}`)
307
+
308
+ console.log(`Running task with ${JSON.stringify({
309
+ cluster: clusterName,
310
+ taskDefinition: taskDefArn,
311
+ count: count,
312
+ startedBy: startedBy,
313
+ networkConfiguration: {
314
+ awsvpcConfiguration: {
315
+ subnets: subnets
316
+ },
317
+ },
300
318
})}`)
301
319
302
320
const runTaskResponse = await ecs.runTask({
303
321
cluster: clusterName,
304
322
taskDefinition: taskDefArn,
305
323
count: count,
306
- startedBy: startedBy
324
+ startedBy: startedBy,
325
+ networkConfiguration: {
326
+ awsvpcConfiguration: {
327
+ subnets: subnets
328
+ },
329
+ },
307
330
}).promise();
308
331
309
332
core.debug(`Run task response ${JSON.stringify(runTaskResponse)}`)
@@ -336,7 +359,7 @@ async function waitForTasksStopped(ecs, clusterName, taskArns, waitForMinutes) {
336
359
const maxAttempts = (waitForMinutes * 60) / WAIT_DEFAULT_DELAY_SEC;
337
360
338
361
core.debug('Waiting for tasks to stop');
339
-
362
+
340
363
const waitTaskResponse = await ecs.waitFor('tasksStopped', {
341
364
cluster: clusterName,
342
365
tasks: taskArns,
@@ -347,7 +370,7 @@ async function waitForTasksStopped(ecs, clusterName, taskArns, waitForMinutes) {
347
370
}).promise();
348
371
349
372
core.debug(`Run task response ${JSON.stringify(waitTaskResponse)}`)
350
-
373
+
351
374
core.info(`All tasks have stopped. Watch progress in the Amazon ECS console: https://console.aws.amazon.com/ecs/home?region=${aws.config.region}#/clusters/${clusterName}/tasks`);
352
375
}
353
376
@@ -362,7 +385,7 @@ async function tasksExitCode(ecs, clusterName, taskArns) {
362
385
const reasons = containers.map(container => container.reason)
363
386
364
387
const failuresIdx = [];
365
-
388
+
366
389
exitCodes.filter((exitCode, index) => {
367
390
if (exitCode !== 0) {
368
391
failuresIdx.push(index)
0 commit comments