Skip to content

Commit d49b663

Browse files
committed
tags input get in runTask
1 parent 43672e2 commit d49b663

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

dist/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const IGNORED_TASK_DEFINITION_ATTRIBUTES = [
2727
];
2828

2929
// Method to run a stand-alone task with desired inputs
30-
async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSManagedTags, runTaskTags) {
30+
async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSManagedTags) {
3131
core.info('Running task')
3232

3333
const waitForTask = core.getInput('wait-for-task-stopped', { required: false }) || 'false';
@@ -37,6 +37,7 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSMa
3737
const securityGroupIds = core.getInput('run-task-security-groups', { required: false }) || '';
3838
const containerOverrides = JSON.parse(core.getInput('run-task-container-overrides', { required: false }) || '[]');
3939
const assignPublicIP = core.getInput('run-task-assign-public-IP', { required: false }) || 'DISABLED';
40+
const tags = JSON.parse(core.getInput('run-task-tags', { required: false }) || '[]');
4041

4142
let awsvpcConfiguration = {}
4243

@@ -62,7 +63,7 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSMa
6263
launchType: launchType,
6364
networkConfiguration: Object.keys(awsvpcConfiguration).length === 0 ? null : { awsvpcConfiguration: awsvpcConfiguration },
6465
enableECSManagedTags: enableECSManagedTags,
65-
tags: runTaskTags
66+
tags: tags
6667
});
6768

6869
core.debug(`Run task response ${JSON.stringify(runTaskResponse)}`)
@@ -404,7 +405,6 @@ async function run() {
404405
const enableECSManagedTagsInput = core.getInput('enable-ecs-managed-tags', { required: false }) || 'false';
405406
const enableECSManagedTags = enableECSManagedTagsInput.toLowerCase() === 'true';
406407
const propagateTags = core.getInput('propagate-tags', { required: false }) || 'NONE';
407-
const runTaskTags = JSON.parse(core.getInput('run-task-tags', { required: false }) || '[]');
408408

409409
// Register the task definition
410410
core.debug('Registering the task definition');
@@ -432,7 +432,7 @@ async function run() {
432432
core.debug(`shouldRunTask: ${shouldRunTask}`);
433433
if (shouldRunTask) {
434434
core.debug("Running ad-hoc task...");
435-
await runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSManagedTags, runTaskTags);
435+
await runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSManagedTags);
436436
}
437437

438438
// Update the service with the new task definition

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const IGNORED_TASK_DEFINITION_ATTRIBUTES = [
2121
];
2222

2323
// Method to run a stand-alone task with desired inputs
24-
async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSManagedTags, runTaskTags) {
24+
async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSManagedTags) {
2525
core.info('Running task')
2626

2727
const waitForTask = core.getInput('wait-for-task-stopped', { required: false }) || 'false';
@@ -31,6 +31,7 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSMa
3131
const securityGroupIds = core.getInput('run-task-security-groups', { required: false }) || '';
3232
const containerOverrides = JSON.parse(core.getInput('run-task-container-overrides', { required: false }) || '[]');
3333
const assignPublicIP = core.getInput('run-task-assign-public-IP', { required: false }) || 'DISABLED';
34+
const tags = JSON.parse(core.getInput('run-task-tags', { required: false }) || '[]');
3435

3536
let awsvpcConfiguration = {}
3637

@@ -56,7 +57,7 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSMa
5657
launchType: launchType,
5758
networkConfiguration: Object.keys(awsvpcConfiguration).length === 0 ? null : { awsvpcConfiguration: awsvpcConfiguration },
5859
enableECSManagedTags: enableECSManagedTags,
59-
tags: runTaskTags
60+
tags: tags
6061
});
6162

6263
core.debug(`Run task response ${JSON.stringify(runTaskResponse)}`)
@@ -398,7 +399,6 @@ async function run() {
398399
const enableECSManagedTagsInput = core.getInput('enable-ecs-managed-tags', { required: false }) || 'false';
399400
const enableECSManagedTags = enableECSManagedTagsInput.toLowerCase() === 'true';
400401
const propagateTags = core.getInput('propagate-tags', { required: false }) || 'NONE';
401-
const runTaskTags = JSON.parse(core.getInput('run-task-tags', { required: false }) || '[]');
402402

403403
// Register the task definition
404404
core.debug('Registering the task definition');
@@ -426,7 +426,7 @@ async function run() {
426426
core.debug(`shouldRunTask: ${shouldRunTask}`);
427427
if (shouldRunTask) {
428428
core.debug("Running ad-hoc task...");
429-
await runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSManagedTags, runTaskTags);
429+
await runTask(ecs, clusterName, taskDefArn, waitForMinutes, enableECSManagedTags);
430430
}
431431

432432
// Update the service with the new task definition

index.test.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,6 @@ describe('Deploy to ECS', () => {
714714
.mockReturnValueOnce('') // desired count
715715
.mockReturnValueOnce('') // enable-ecs-managed-tags
716716
.mockReturnValueOnce('') // propagate-task
717-
.mockReturnValueOnce('') // run-task-tags
718717
.mockReturnValueOnce('/hello/appspec.json') // codedeploy-appspec
719718
.mockReturnValueOnce('MyApplication') // codedeploy-application
720719
.mockReturnValueOnce('MyDeploymentGroup'); // codedeploy-deployment-group
@@ -1132,7 +1131,6 @@ describe('Deploy to ECS', () => {
11321131
.mockReturnValueOnce('') // wait-for-minutes
11331132
.mockReturnValueOnce('') // enable-ecs-managed-tags
11341133
.mockReturnValueOnce('') // propagate-tags
1135-
.mockReturnValueOnce('') // run-task-tags
11361134
.mockReturnValueOnce('') // force-new-deployment
11371135
.mockReturnValueOnce('') // desired-count
11381136
.mockReturnValueOnce('true'); // run-task
@@ -1169,7 +1167,6 @@ describe('Deploy to ECS', () => {
11691167
.mockReturnValueOnce('') // desired-count
11701168
.mockReturnValueOnce('false') // enable-ecs-managed-tags
11711169
.mockReturnValueOnce('') // propagate-tags
1172-
.mockReturnValueOnce('') // run-task-tags
11731170
.mockReturnValueOnce('true') // run-task
11741171
.mockReturnValueOnce('false') // wait-for-task-stopped
11751172
.mockReturnValueOnce('someJoe') // run-task-started-by
@@ -1208,7 +1205,6 @@ describe('Deploy to ECS', () => {
12081205
.mockReturnValueOnce('') // desired-count
12091206
.mockReturnValueOnce('') // enable-ecs-managed-tags
12101207
.mockReturnValueOnce('') // propagate-tags
1211-
.mockReturnValueOnce('') // run-task-tags
12121208
.mockReturnValueOnce('true') // run-task
12131209
.mockReturnValueOnce('false') // wait-for-task-stopped
12141210
.mockReturnValueOnce('someJoe') // run-task-started-by
@@ -1259,7 +1255,6 @@ describe('Deploy to ECS', () => {
12591255
.mockReturnValueOnce('') // desired-count
12601256
.mockReturnValueOnce('') // enable-ecs-managed-tags
12611257
.mockReturnValueOnce('') // propagate-tags
1262-
.mockReturnValueOnce('') // run-task-tags
12631258
.mockReturnValueOnce('true') // run-task
12641259
.mockReturnValueOnce('true'); // wait-for-task-stopped
12651260

@@ -1285,7 +1280,6 @@ describe('Deploy to ECS', () => {
12851280
.mockReturnValueOnce('') // force-new-deployment
12861281
.mockReturnValueOnce('') // desired-count
12871282
.mockReturnValueOnce('') // propagate-tags
1288-
.mockReturnValueOnce('') // run-task-tags
12891283
.mockReturnValueOnce('true') // run-task
12901284
.mockReturnValueOnce('true') // wait-for-task-stopped
12911285
.mockReturnValueOnce('someJoe') // run-task-started-by
@@ -1363,7 +1357,6 @@ describe('Deploy to ECS', () => {
13631357
.mockReturnValueOnce('') // desired-count
13641358
.mockReturnValueOnce('') // enable-ecs-managed-tags
13651359
.mockReturnValueOnce('') // propagate-tags
1366-
.mockReturnValueOnce('') // run-task-tags
13671360
.mockReturnValueOnce('true') // run-task
13681361
.mockReturnValueOnce('false'); // wait-for-task-stopped
13691362

0 commit comments

Comments
 (0)