Skip to content

Commit baa28a1

Browse files
author
GitHub Actions
committed
chore: Update dist
1 parent 90f0c58 commit baa28a1

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

dist/index.js

+33-13
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,10 @@ async function run() {
274274
if (waitForMinutes > MAX_WAIT_MINUTES) {
275275
waitForMinutes = MAX_WAIT_MINUTES;
276276
}
277-
const subnets = core.getInput('subnets', { required: false });
278-
const securityGroups = core.getInput('security-groups', {
277+
const subnetsString = core.getInput('subnets', { required: false }) || '';
278+
const securityGroupsString = core.getInput('security-groups', {
279279
required: false,
280-
});
280+
}) || '';
281281
const launchType = core.getInput('launch-type', { required: false });
282282
const capacityProviderStrategyString = core.getInput('capacity-provider-strategy', { required: false }) || '';
283283
const assignPublicIp = core.getInput('assign-public-ip', {
@@ -328,23 +328,43 @@ async function run() {
328328
startedBy: startedBy,
329329
};
330330

331+
// Configure Networking Options.
332+
let subnets = undefined;
333+
if (subnetsString !== '') {
334+
subnets = subnetsString.split(',');
335+
}
336+
337+
let securityGroups = undefined;
338+
if (securityGroupsString !== '') {
339+
securityGroups = securityGroupsString.split(',');
340+
}
341+
342+
// Will only be assigned to FARGATE launch type, or when a capacity provider is set.
343+
const vpcConfiguration = {
344+
subnets: subnets,
345+
securityGroups: securityGroups,
346+
assignPublicIp,
347+
}
348+
331349
if (launchType === 'FARGATE') {
332350
runTaskRequest.launchType = launchType;
351+
// FARGATE launch type requires awsvpcConfiguration.
333352
runTaskRequest.networkConfiguration = {
334-
awsvpcConfiguration: {
335-
subnets: subnets.split(','),
336-
securityGroups: securityGroups.split(','),
337-
assignPublicIp,
338-
},
339-
};
353+
awsvpcConfiguration: vpcConfiguration,
354+
}
340355
}
341356

342-
// Only parse capacity provider if value has been set.
343-
let capacityProviderStrategy;
357+
// Only parse capacity provider if value has been set. Overrides launch type.
344358
if (capacityProviderStrategyString !== "") {
345359
try {
346-
capacityProviderStrategy = JSON.parse(capacityProviderStrategyString);
347-
runTaskRequest.capacityProviderStrategy = capacityProviderStrategy;
360+
core.info(`Capacity provider strategy is set. Launch type will be ignored.`);
361+
runTaskRequest.launchType = undefined;
362+
runTaskRequest.capacityProviderStrategy = JSON.parse(capacityProviderStrategyString);
363+
364+
// If capacity provider is provided, then awsvpcConfiguration is required.
365+
runTaskRequest.networkConfiguration = {
366+
awsvpcConfiguration: vpcConfiguration,
367+
}
348368
} catch (error) {
349369
core.setFailed("Failed to parse capacity provider strategy definition: " + error.message);
350370
core.debug("Parameter value:");

0 commit comments

Comments
 (0)