diff --git a/dist/index.js b/dist/index.js index b05277b16..39242224d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -45,7 +45,7 @@ async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForSe const region = await ecs.config.region(); const consoleHostname = region.startsWith('cn') ? 'console.amazonaws.cn' : 'console.aws.amazon.com'; - core.info(`Deployment started. Watch this deployment's progress in the Amazon ECS console: https://${consoleHostname}/ecs/home?region=${region}#/clusters/${clusterName}/services/${service}/events`); + core.info(`Deployment started. Watch this deployment's progress in the Amazon ECS console: https://${region}.${consoleHostname}/ecs/v2/clusters/${clusterName}/services/${service}/events?region=${region}`); // Wait for service stability if (waitForService && waitForService.toLowerCase() === 'true') { diff --git a/index.js b/index.js index 20d7dee22..a807613ae 100644 --- a/index.js +++ b/index.js @@ -39,7 +39,7 @@ async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForSe const region = await ecs.config.region(); const consoleHostname = region.startsWith('cn') ? 'console.amazonaws.cn' : 'console.aws.amazon.com'; - core.info(`Deployment started. Watch this deployment's progress in the Amazon ECS console: https://${consoleHostname}/ecs/home?region=${region}#/clusters/${clusterName}/services/${service}/events`); + core.info(`Deployment started. Watch this deployment's progress in the Amazon ECS console: https://${region}.${consoleHostname}/ecs/v2/clusters/${clusterName}/services/${service}/events?region=${region}`); // Wait for service stability if (waitForService && waitForService.toLowerCase() === 'true') { diff --git a/index.test.js b/index.test.js index 2550c03bf..c9854831a 100644 --- a/index.test.js +++ b/index.test.js @@ -17,7 +17,7 @@ const mockEcsDescribeServices = jest.fn(); const mockCodeDeployCreateDeployment = jest.fn(); const mockCodeDeployGetDeploymentGroup = jest.fn(); const config = { - region: () => Promise.resolve('fake-region'), + region: () => Promise.resolve('fake-region'), }; jest.mock('@aws-sdk/client-codedeploy'); @@ -121,7 +121,7 @@ describe('Deploy to ECS', () => { test('registers the task definition contents and updates the service', async () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn'); expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, { cluster: 'cluster-789', @@ -134,7 +134,7 @@ describe('Deploy to ECS', () => { forceNewDeployment: false }); expect(waitUntilServicesStable).toHaveBeenCalledTimes(0); - expect(core.info).toBeCalledWith("Deployment started. Watch this deployment's progress in the Amazon ECS console: https://console.aws.amazon.com/ecs/home?region=fake-region#/clusters/cluster-789/services/service-456/events"); + expect(core.info).toBeCalledWith("Deployment started. Watch this deployment's progress in the Amazon ECS console: https://fake-region.console.aws.amazon.com/ecs/v2/clusters/cluster-789/services/service-456/events?region=fake-region"); }); test('registers the task definition contents and updates the service if deployment controller type is ECS', async () => { @@ -152,7 +152,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn'); expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, { cluster: 'cluster-789', @@ -165,7 +165,7 @@ describe('Deploy to ECS', () => { forceNewDeployment: false }); expect(waitUntilServicesStable).toHaveBeenCalledTimes(0); - expect(core.info).toBeCalledWith("Deployment started. Watch this deployment's progress in the Amazon ECS console: https://console.aws.amazon.com/ecs/home?region=fake-region#/clusters/cluster-789/services/service-456/events"); + expect(core.info).toBeCalledWith("Deployment started. Watch this deployment's progress in the Amazon ECS console: https://fake-region.console.aws.amazon.com/ecs/v2/clusters/cluster-789/services/service-456/events?region=fake-region"); }); test('prints Chinese console domain for cn regions', async () => { @@ -173,7 +173,7 @@ describe('Deploy to ECS', () => { config.region = () => Promise.resolve('cn-fake-region'); await run(); - expect(core.info).toBeCalledWith("Deployment started. Watch this deployment's progress in the Amazon ECS console: https://console.amazonaws.cn/ecs/home?region=cn-fake-region#/clusters/cluster-789/services/service-456/events"); + expect(core.info).toBeCalledWith("Deployment started. Watch this deployment's progress in the Amazon ECS console: https://cn-fake-region.console.amazonaws.cn/ecs/v2/clusters/cluster-789/services/service-456/events?region=cn-fake-region"); // reset config.region = originalRegion; @@ -190,7 +190,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); }); test('cleans empty arrays out of the task definition contents', async () => { @@ -204,7 +204,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); }); test('cleans empty strings and objects out of the task definition contents', async () => { @@ -269,7 +269,7 @@ describe('Deploy to ECS', () => { }] } ], - requiresCompatibilities: [ 'EC2' ] + requiresCompatibilities: ['EC2'] }); }); @@ -365,7 +365,7 @@ describe('Deploy to ECS', () => { }] } ], - requiresCompatibilities: [ 'EC2' ], + requiresCompatibilities: ['EC2'], proxyConfiguration: { type: "APPMESH", containerName: "envoy", @@ -418,7 +418,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); }); test('registers the task definition contents and creates a CodeDeploy deployment, waits for 30 minutes + deployment group wait time', async () => { @@ -444,7 +444,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn'); expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, { cluster: 'cluster-789', @@ -457,21 +457,21 @@ describe('Deploy to ECS', () => { revision: { revisionType: 'AppSpecContent', appSpecContent: { - content: JSON.stringify({ - Resources: [{ - TargetService: { - Type: 'AWS::ECS::Service', - Properties: { - TaskDefinition: 'task:def:arn', - LoadBalancerInfo: { - ContainerName: "web", - ContainerPort: 80 + content: JSON.stringify({ + Resources: [{ + TargetService: { + Type: 'AWS::ECS::Service', + Properties: { + TaskDefinition: 'task:def:arn', + LoadBalancerInfo: { + ContainerName: "web", + ContainerPort: 80 + } } - } - } - }] + } + }] }), - sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096' + sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096' } } }); @@ -522,7 +522,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn'); expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, { cluster: 'cluster-789', @@ -535,21 +535,21 @@ describe('Deploy to ECS', () => { revision: { revisionType: 'AppSpecContent', appSpecContent: { - content: JSON.stringify({ - Resources: [{ - TargetService: { - Type: 'AWS::ECS::Service', - Properties: { - TaskDefinition: 'task:def:arn', - LoadBalancerInfo: { - ContainerName: "web", - ContainerPort: 80 + content: JSON.stringify({ + Resources: [{ + TargetService: { + Type: 'AWS::ECS::Service', + Properties: { + TaskDefinition: 'task:def:arn', + LoadBalancerInfo: { + ContainerName: "web", + ContainerPort: 80 + } } - } - } - }] + } + }] }), - sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096' + sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096' } } }); @@ -598,7 +598,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn'); expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, { cluster: 'cluster-789', @@ -611,21 +611,21 @@ describe('Deploy to ECS', () => { revision: { revisionType: 'AppSpecContent', appSpecContent: { - content: JSON.stringify({ - Resources: [{ - TargetService: { - Type: 'AWS::ECS::Service', - Properties: { - TaskDefinition: 'task:def:arn', - LoadBalancerInfo: { - ContainerName: "web", - ContainerPort: 80 + content: JSON.stringify({ + Resources: [{ + TargetService: { + Type: 'AWS::ECS::Service', + Properties: { + TaskDefinition: 'task:def:arn', + LoadBalancerInfo: { + ContainerName: "web", + ContainerPort: 80 + } } - } - } - }] + } + }] }), - sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096' + sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096' } } }); @@ -726,7 +726,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn'); expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, { cluster: 'cluster-789', @@ -739,21 +739,21 @@ describe('Deploy to ECS', () => { revision: { revisionType: 'AppSpecContent', appSpecContent: { - content: JSON.stringify({ - Resources: [{ - TargetService: { - Type: 'AWS::ECS::Service', - Properties: { - TaskDefinition: 'task:def:arn', - LoadBalancerInfo: { - ContainerName: "web", - ContainerPort: 80 + content: JSON.stringify({ + Resources: [{ + TargetService: { + Type: 'AWS::ECS::Service', + Properties: { + TaskDefinition: 'task:def:arn', + LoadBalancerInfo: { + ContainerName: "web", + ContainerPort: 80 + } } - } - } - }] + } + }] }), - sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096' + sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096' } } }); @@ -793,7 +793,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn'); expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, { cluster: 'cluster-789', @@ -866,7 +866,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family-absolute-path'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family-absolute-path' }); expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn'); }); @@ -882,7 +882,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn'); expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, { cluster: 'cluster-789', @@ -921,7 +921,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn'); expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, { cluster: 'cluster-789', @@ -960,7 +960,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn'); expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, { cluster: 'cluster-789', @@ -1000,7 +1000,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn'); expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, { cluster: 'cluster-789', @@ -1025,7 +1025,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn'); expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, { cluster: 'default', @@ -1047,7 +1047,7 @@ describe('Deploy to ECS', () => { await run(); expect(core.setFailed).toHaveBeenCalledTimes(0); - expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'}); + expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' }); expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn'); expect(mockEcsDescribeServices).toHaveBeenCalledTimes(0); expect(mockEcsUpdateService).toHaveBeenCalledTimes(0); @@ -1132,4 +1132,4 @@ describe('Deploy to ECS', () => { expect(core.setFailed).toHaveBeenNthCalledWith(1, 'Failed to register task definition in ECS: Could not parse'); expect(core.setFailed).toHaveBeenNthCalledWith(2, 'Could not parse'); }); - }); +}); diff --git a/package-lock.json b/package-lock.json index 0874dcf2e..e0f338ebf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "aws-actions-amazon-ecs-deploy-task-definition", - "version": "1.5.0", + "version": "1.6.0", "license": "MIT", "dependencies": { "@actions/core": "^1.10.1",