Skip to content

Commit e4558ed

Browse files
authored
fix: when no input enableECSManagedTagsInput, not include it to request params (#669)
* handle enableECSManagedTagsInput when no input enableECSManagedTagsInput, not include it to request params * npm run package * npm ci && npm run package * merge master commit 0f24c17 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue Nov 19 16:08:17 2024 +0000 chore: Bump @aws-sdk/client-codedeploy from 3.687.0 to 3.693.0 (#682) * chore: Bump @aws-sdk/client-codedeploy from 3.687.0 to 3.693.0 Bumps [@aws-sdk/client-codedeploy](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-codedeploy) from 3.687.0 to 3.693.0. - [Release notes](https://github.com/aws/aws-sdk-js-v3/releases) - [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-codedeploy/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.693.0/clients/client-codedeploy) --- updated-dependencies: - dependency-name: "@aws-sdk/client-codedeploy" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * chore: Update dist --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: GitHub Actions <runner@fv-az2021-651.3wxedyhetzae5an0xyfe2w1byg.dx.internal.cloudapp.net> Co-authored-by: Reecha Khanal <[email protected]> commit 103f366 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue Nov 19 05:12:34 2024 +0000 chore: Bump @vercel/ncc from 0.38.2 to 0.38.3 (#683) Bumps [@vercel/ncc](https://github.com/vercel/ncc) from 0.38.2 to 0.38.3. - [Release notes](https://github.com/vercel/ncc/releases) - [Commits](vercel/ncc@0.38.2...0.38.3) --- updated-dependencies: - dependency-name: "@vercel/ncc" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 7a7648f Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue Nov 19 05:10:17 2024 +0000 chore: Bump eslint from 9.14.0 to 9.15.0 (#681) Bumps [eslint](https://github.com/eslint/eslint) from 9.14.0 to 9.15.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](eslint/eslint@v9.14.0...v9.15.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 38ef14b Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue Nov 19 05:07:46 2024 +0000 chore: Bump @eslint/js from 9.14.0 to 9.15.0 (#679) Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.14.0 to 9.15.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/commits/v9.15.0/packages/js) --- updated-dependencies: - dependency-name: "@eslint/js" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * npm run package * npm ci & npm run package * set enableECSManagedTags in updateEcsService and runTask when input is exist
1 parent 69a85ec commit e4558ed

File tree

3 files changed

+142
-16
lines changed

3 files changed

+142
-16
lines changed

dist/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,11 @@ async function run() {
404404
const forceNewDeployInput = core.getInput('force-new-deployment', { required: false }) || 'false';
405405
const forceNewDeployment = forceNewDeployInput.toLowerCase() === 'true';
406406
const desiredCount = parseInt((core.getInput('desired-count', {required: false})));
407-
const enableECSManagedTagsInput = core.getInput('enable-ecs-managed-tags', { required: false }) || 'false';
408-
const enableECSManagedTags = enableECSManagedTagsInput.toLowerCase() === 'true';
407+
const enableECSManagedTagsInput = core.getInput('enable-ecs-managed-tags', { required: false }) || '';
408+
let enableECSManagedTags = null;
409+
if (enableECSManagedTagsInput !== '') {
410+
enableECSManagedTags = enableECSManagedTagsInput.toLowerCase() === 'true';
411+
}
409412
const propagateTags = core.getInput('propagate-tags', { required: false }) || 'NONE';
410413

411414
// Register the task definition

index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,11 @@ async function run() {
398398
const forceNewDeployInput = core.getInput('force-new-deployment', { required: false }) || 'false';
399399
const forceNewDeployment = forceNewDeployInput.toLowerCase() === 'true';
400400
const desiredCount = parseInt((core.getInput('desired-count', {required: false})));
401-
const enableECSManagedTagsInput = core.getInput('enable-ecs-managed-tags', { required: false }) || 'false';
402-
const enableECSManagedTags = enableECSManagedTagsInput.toLowerCase() === 'true';
401+
const enableECSManagedTagsInput = core.getInput('enable-ecs-managed-tags', { required: false }) || '';
402+
let enableECSManagedTags = null;
403+
if (enableECSManagedTagsInput !== '') {
404+
enableECSManagedTags = enableECSManagedTagsInput.toLowerCase() === 'true';
405+
}
403406
const propagateTags = core.getInput('propagate-tags', { required: false }) || 'NONE';
404407

405408
// Register the task definition

index.test.js

Lines changed: 132 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ describe('Deploy to ECS', () => {
186186
service: 'service-456',
187187
taskDefinition: 'task:def:arn',
188188
forceNewDeployment: false,
189-
enableECSManagedTags: false,
189+
enableECSManagedTags: null,
190190
propagateTags: 'NONE'
191191
});
192192
expect(waitUntilServicesStable).toHaveBeenCalledTimes(0);
@@ -219,7 +219,7 @@ describe('Deploy to ECS', () => {
219219
service: 'service-456',
220220
taskDefinition: 'task:def:arn',
221221
forceNewDeployment: false,
222-
enableECSManagedTags: false,
222+
enableECSManagedTags: null,
223223
propagateTags: 'NONE'
224224
});
225225
expect(waitUntilServicesStable).toHaveBeenCalledTimes(0);
@@ -954,7 +954,7 @@ describe('Deploy to ECS', () => {
954954
service: 'service-456',
955955
taskDefinition: 'task:def:arn',
956956
forceNewDeployment: false,
957-
enableECSManagedTags: false,
957+
enableECSManagedTags: null,
958958
propagateTags: 'NONE'
959959
});
960960
expect(waitUntilServicesStable).toHaveBeenNthCalledWith(
@@ -995,7 +995,7 @@ describe('Deploy to ECS', () => {
995995
service: 'service-456',
996996
taskDefinition: 'task:def:arn',
997997
forceNewDeployment: false,
998-
enableECSManagedTags: false,
998+
enableECSManagedTags: null,
999999
propagateTags: 'NONE'
10001000
});
10011001
expect(waitUntilServicesStable).toHaveBeenNthCalledWith(
@@ -1036,7 +1036,7 @@ describe('Deploy to ECS', () => {
10361036
service: 'service-456',
10371037
taskDefinition: 'task:def:arn',
10381038
forceNewDeployment: false,
1039-
enableECSManagedTags: false,
1039+
enableECSManagedTags: null,
10401040
propagateTags: 'NONE'
10411041
});
10421042
expect(waitUntilServicesStable).toHaveBeenNthCalledWith(
@@ -1079,7 +1079,7 @@ describe('Deploy to ECS', () => {
10791079
service: 'service-456',
10801080
taskDefinition: 'task:def:arn',
10811081
forceNewDeployment: true,
1082-
enableECSManagedTags: false,
1082+
enableECSManagedTags: null,
10831083
propagateTags: 'NONE'
10841084
});
10851085
});
@@ -1105,7 +1105,7 @@ describe('Deploy to ECS', () => {
11051105
service: 'service-456',
11061106
taskDefinition: 'task:def:arn',
11071107
forceNewDeployment: false,
1108-
enableECSManagedTags: false,
1108+
enableECSManagedTags: null,
11091109
propagateTags: 'NONE'
11101110
});
11111111
});
@@ -1152,7 +1152,7 @@ describe('Deploy to ECS', () => {
11521152
taskDefinition: 'task:def:arn',
11531153
overrides: {"containerOverrides": []},
11541154
networkConfiguration: null,
1155-
enableECSManagedTags: false,
1155+
enableECSManagedTags: null,
11561156
tags: []
11571157
});
11581158

@@ -1276,7 +1276,7 @@ describe('Deploy to ECS', () => {
12761276
service: 'service-456',
12771277
taskDefinition: 'task:def:arn',
12781278
forceNewDeployment: false,
1279-
enableECSManagedTags: false,
1279+
enableECSManagedTags: null,
12801280
propagateTags: 'NONE',
12811281
});
12821282
expect(mockRunTask).toHaveBeenCalledWith({
@@ -1287,7 +1287,7 @@ describe('Deploy to ECS', () => {
12871287
launchType: 'EC2',
12881288
overrides: { containerOverrides: [{ name: 'someapp', command: 'somecmd' }] },
12891289
networkConfiguration: { awsvpcConfiguration: { subnets: ['a', 'b'], securityGroups: ['c', 'd'], assignPublicIp: "DISABLED" } },
1290-
enableECSManagedTags: false,
1290+
enableECSManagedTags: null,
12911291
tags: []
12921292
});
12931293
expect(core.setOutput).toHaveBeenNthCalledWith(2, 'run-task-arn', ["arn:aws:ecs:fake-region:account_id:task/arn"]);
@@ -1348,6 +1348,62 @@ describe('Deploy to ECS', () => {
13481348
launchType: 'EC2',
13491349
overrides: { containerOverrides: [] },
13501350
networkConfiguration: null,
1351+
enableECSManagedTags: null,
1352+
tags: []
1353+
});
1354+
});
1355+
1356+
test('run task with setting true to enableECSManagedTags', async () => {
1357+
core.getInput = jest
1358+
.fn()
1359+
.mockReturnValueOnce('task-definition.json') // task-definition
1360+
.mockReturnValueOnce('') // service
1361+
.mockReturnValueOnce('somecluster') // cluster
1362+
.mockReturnValueOnce('') // wait-for-service-stability
1363+
.mockReturnValueOnce('') // wait-for-minutes
1364+
.mockReturnValueOnce('') // force-new-deployment
1365+
.mockReturnValueOnce('') // desired-count
1366+
.mockReturnValueOnce('true') // enable-ecs-managed-tags
1367+
.mockReturnValueOnce('') // propagate-tags
1368+
.mockReturnValueOnce('true'); // run-task
1369+
1370+
await run();
1371+
expect(mockRunTask).toHaveBeenCalledWith({
1372+
startedBy: 'GitHub-Actions',
1373+
cluster: 'somecluster',
1374+
taskDefinition: 'task:def:arn',
1375+
capacityProviderStrategy: null,
1376+
launchType: 'FARGATE',
1377+
overrides: { containerOverrides: [] },
1378+
networkConfiguration: null,
1379+
enableECSManagedTags: true,
1380+
tags: []
1381+
});
1382+
});
1383+
1384+
test('run task with setting false to enableECSManagedTags', async () => {
1385+
core.getInput = jest
1386+
.fn()
1387+
.mockReturnValueOnce('task-definition.json') // task-definition
1388+
.mockReturnValueOnce('') // service
1389+
.mockReturnValueOnce('somecluster') // cluster
1390+
.mockReturnValueOnce('') // wait-for-service-stability
1391+
.mockReturnValueOnce('') // wait-for-minutes
1392+
.mockReturnValueOnce('') // force-new-deployment
1393+
.mockReturnValueOnce('') // desired-count
1394+
.mockReturnValueOnce('false') // enable-ecs-managed-tags
1395+
.mockReturnValueOnce('') // propagate-tags
1396+
.mockReturnValueOnce('true'); // run-task
1397+
1398+
await run();
1399+
expect(mockRunTask).toHaveBeenCalledWith({
1400+
startedBy: 'GitHub-Actions',
1401+
cluster: 'somecluster',
1402+
taskDefinition: 'task:def:arn',
1403+
capacityProviderStrategy: null,
1404+
launchType: 'FARGATE',
1405+
overrides: { containerOverrides: [] },
1406+
networkConfiguration: null,
13511407
enableECSManagedTags: false,
13521408
tags: []
13531409
});
@@ -1519,7 +1575,39 @@ describe('Deploy to ECS', () => {
15191575
expect(core.setFailed).toHaveBeenNthCalledWith(2, 'Could not parse');
15201576
});
15211577

1522-
test('propagate service tags from service and enable ecs managed tags', async () => {
1578+
test('propagate service tags from service', async () => {
1579+
core.getInput = jest
1580+
.fn()
1581+
.mockReturnValueOnce('task-definition.json') // task-definition
1582+
.mockReturnValueOnce('service-456') // service
1583+
.mockReturnValueOnce('cluster-789') // cluster
1584+
.mockReturnValueOnce('false') // wait-for-service-stability
1585+
.mockReturnValueOnce('') // wait-for-minutes
1586+
.mockReturnValueOnce('') // force-new-deployment
1587+
.mockReturnValueOnce('') // desired-count
1588+
.mockReturnValueOnce('') // enable-ecs-managed-tags
1589+
.mockReturnValueOnce('SERVICE'); // propagate-tags
1590+
1591+
await run();
1592+
expect(core.setFailed).toHaveBeenCalledTimes(0);
1593+
1594+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
1595+
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
1596+
expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, {
1597+
cluster: 'cluster-789',
1598+
services: ['service-456']
1599+
});
1600+
expect(mockEcsUpdateService).toHaveBeenNthCalledWith(1, {
1601+
cluster: 'cluster-789',
1602+
service: 'service-456',
1603+
taskDefinition: 'task:def:arn',
1604+
forceNewDeployment: false,
1605+
enableECSManagedTags: null,
1606+
propagateTags: 'SERVICE'
1607+
});
1608+
});
1609+
1610+
test('update service with setting true to enableECSManagedTags', async () => {
15231611
core.getInput = jest
15241612
.fn()
15251613
.mockReturnValueOnce('task-definition.json') // task-definition
@@ -1550,4 +1638,36 @@ describe('Deploy to ECS', () => {
15501638
propagateTags: 'SERVICE'
15511639
});
15521640
});
1553-
});
1641+
1642+
test('update service with setting false to enableECSManagedTags', async () => {
1643+
core.getInput = jest
1644+
.fn()
1645+
.mockReturnValueOnce('task-definition.json') // task-definition
1646+
.mockReturnValueOnce('service-456') // service
1647+
.mockReturnValueOnce('cluster-789') // cluster
1648+
.mockReturnValueOnce('false') // wait-for-service-stability
1649+
.mockReturnValueOnce('') // wait-for-minutes
1650+
.mockReturnValueOnce('') // force-new-deployment
1651+
.mockReturnValueOnce('') // desired-count
1652+
.mockReturnValueOnce('false') // enable-ecs-managed-tags
1653+
.mockReturnValueOnce('SERVICE'); // propagate-tags
1654+
1655+
await run();
1656+
expect(core.setFailed).toHaveBeenCalledTimes(0);
1657+
1658+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
1659+
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
1660+
expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, {
1661+
cluster: 'cluster-789',
1662+
services: ['service-456']
1663+
});
1664+
expect(mockEcsUpdateService).toHaveBeenNthCalledWith(1, {
1665+
cluster: 'cluster-789',
1666+
service: 'service-456',
1667+
taskDefinition: 'task:def:arn',
1668+
forceNewDeployment: false,
1669+
enableECSManagedTags: false,
1670+
propagateTags: 'SERVICE'
1671+
});
1672+
});
1673+
});

0 commit comments

Comments
 (0)