Skip to content

Commit 4cc9e49

Browse files
committed
cleaning up code and organzie
1 parent c279797 commit 4cc9e49

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

action.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ inputs:
4040
force-new-deployment:
4141
description: 'Whether to force a new deployment of the service. Valid value is "true". Will default to not force a new deployment.'
4242
required: false
43-
#one off task inputs
4443
run-task:
4544
description: 'A boolean indicating whether to run a stand-alone task in a ECS cluster. Task will run before the service is updated if both are provided. Default value is false .'
4645
required: false
@@ -64,8 +63,7 @@ inputs:
6463
required: false
6564
wait-for-task-stopped:
6665
description: 'Whether to wait for the task to stop when running it outside of a service. Will default to not wait.'
67-
required: false
68-
#back to original inputs
66+
required: false
6967
outputs:
7068
task-definition-arn:
7169
description: 'The ARN of the registered ECS task definition'

dist/index.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const IGNORED_TASK_DEFINITION_ATTRIBUTES = [
2626
'registeredBy'
2727
];
2828

29-
//Code to run task outside of a service aka (also known as) a one-off task
30-
async function runTask(ecs,clusterName, taskDefArn, waitForMinutes) {
29+
//method to run a stand-alone task with dersired inputs
30+
async function runTask(ecs, clusterName, taskDefArn, waitForMinutes) {
3131
core.info('Running task')
3232

3333
const waitForTask = core.getInput('wait-for-task-stopped', { required: false }) || 'false';
@@ -61,10 +61,8 @@ async function runTask(ecs,clusterName, taskDefArn, waitForMinutes) {
6161
},
6262
launchType: launchType,
6363
networkConfiguration: Object.keys(awsvpcConfiguration).length === 0 ? {} : { awsvpcConfiguration: awsvpcConfiguration },
64-
6564
});
6665

67-
6866
core.debug(`Run task response ${JSON.stringify(runTaskResponse)}`)
6967

7068
const taskArns = runTaskResponse.tasks.map(task => task.taskArn);
@@ -73,7 +71,6 @@ async function runTask(ecs,clusterName, taskDefArn, waitForMinutes) {
7371
const region = await ecs.config.region();
7472
const consoleHostname = region.startsWith('cn') ? 'console.amazonaws.cn' : 'console.aws.amazon.com';
7573

76-
7774
core.info(`Task running: https://${consoleHostname}/ecs/home?region=${region}#/clusters/${clusterName}/tasks`);
7875

7976

@@ -137,7 +134,6 @@ async function tasksExitCode(ecs, clusterName, taskArns) {
137134
}
138135
}
139136

140-
141137
// Deploy to a service that uses the 'ECS' deployment controller
142138
async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForService, waitForMinutes, forceNewDeployment, desiredCount) {
143139
core.debug('Updating the service');
@@ -431,7 +427,6 @@ async function run() {
431427

432428
// Update the service with the new task definition
433429
if (service) {
434-
435430
// Determine the deployment controller
436431
const describeResponse = await ecs.describeServices({
437432
services: [service],

index.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const IGNORED_TASK_DEFINITION_ATTRIBUTES = [
2020
'registeredBy'
2121
];
2222

23-
//Code to run task outside of a service aka (also known as) a one-off task
24-
async function runTask(ecs,clusterName, taskDefArn, waitForMinutes) {
23+
//method to run a stand-alone task with dersired inputs
24+
async function runTask(ecs, clusterName, taskDefArn, waitForMinutes) {
2525
core.info('Running task')
2626

2727
const waitForTask = core.getInput('wait-for-task-stopped', { required: false }) || 'false';
@@ -55,10 +55,8 @@ async function runTask(ecs,clusterName, taskDefArn, waitForMinutes) {
5555
},
5656
launchType: launchType,
5757
networkConfiguration: Object.keys(awsvpcConfiguration).length === 0 ? {} : { awsvpcConfiguration: awsvpcConfiguration },
58-
5958
});
6059

61-
6260
core.debug(`Run task response ${JSON.stringify(runTaskResponse)}`)
6361

6462
const taskArns = runTaskResponse.tasks.map(task => task.taskArn);
@@ -67,7 +65,6 @@ async function runTask(ecs,clusterName, taskDefArn, waitForMinutes) {
6765
const region = await ecs.config.region();
6866
const consoleHostname = region.startsWith('cn') ? 'console.amazonaws.cn' : 'console.aws.amazon.com';
6967

70-
7168
core.info(`Task running: https://${consoleHostname}/ecs/home?region=${region}#/clusters/${clusterName}/tasks`);
7269

7370

@@ -131,7 +128,6 @@ async function tasksExitCode(ecs, clusterName, taskArns) {
131128
}
132129
}
133130

134-
135131
// Deploy to a service that uses the 'ECS' deployment controller
136132
async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForService, waitForMinutes, forceNewDeployment, desiredCount) {
137133
core.debug('Updating the service');
@@ -425,7 +421,6 @@ async function run() {
425421

426422
// Update the service with the new task definition
427423
if (service) {
428-
429424
// Determine the deployment controller
430425
const describeResponse = await ecs.describeServices({
431426
services: [service],

0 commit comments

Comments
 (0)