Skip to content

Commit 1a69dae

Browse files
authored
fix: Link to events v2 url (#588)
* Update events URL to use v2 version since v1 is deprecated * Updated tests and documentation
1 parent bee9be6 commit 1a69dae

File tree

4 files changed

+79
-79
lines changed

4 files changed

+79
-79
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForSe
4545
const region = await ecs.config.region();
4646
const consoleHostname = region.startsWith('cn') ? 'console.amazonaws.cn' : 'console.aws.amazon.com';
4747

48-
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`);
48+
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}`);
4949

5050
// Wait for service stability
5151
if (waitForService && waitForService.toLowerCase() === 'true') {

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async function updateEcsService(ecs, clusterName, service, taskDefArn, waitForSe
3939
const region = await ecs.config.region();
4040
const consoleHostname = region.startsWith('cn') ? 'console.amazonaws.cn' : 'console.aws.amazon.com';
4141

42-
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`);
42+
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}`);
4343

4444
// Wait for service stability
4545
if (waitForService && waitForService.toLowerCase() === 'true') {

index.test.js

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const mockEcsDescribeServices = jest.fn();
1717
const mockCodeDeployCreateDeployment = jest.fn();
1818
const mockCodeDeployGetDeploymentGroup = jest.fn();
1919
const config = {
20-
region: () => Promise.resolve('fake-region'),
20+
region: () => Promise.resolve('fake-region'),
2121
};
2222

2323
jest.mock('@aws-sdk/client-codedeploy');
@@ -121,7 +121,7 @@ describe('Deploy to ECS', () => {
121121
test('registers the task definition contents and updates the service', async () => {
122122
await run();
123123
expect(core.setFailed).toHaveBeenCalledTimes(0);
124-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
124+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
125125
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
126126
expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, {
127127
cluster: 'cluster-789',
@@ -134,7 +134,7 @@ describe('Deploy to ECS', () => {
134134
forceNewDeployment: false
135135
});
136136
expect(waitUntilServicesStable).toHaveBeenCalledTimes(0);
137-
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");
137+
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");
138138
});
139139

140140
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', () => {
152152

153153
await run();
154154
expect(core.setFailed).toHaveBeenCalledTimes(0);
155-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
155+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
156156
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
157157
expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, {
158158
cluster: 'cluster-789',
@@ -165,15 +165,15 @@ describe('Deploy to ECS', () => {
165165
forceNewDeployment: false
166166
});
167167
expect(waitUntilServicesStable).toHaveBeenCalledTimes(0);
168-
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");
168+
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");
169169
});
170170

171171
test('prints Chinese console domain for cn regions', async () => {
172172
const originalRegion = config.region;
173173
config.region = () => Promise.resolve('cn-fake-region');
174174
await run();
175175

176-
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");
176+
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");
177177

178178
// reset
179179
config.region = originalRegion;
@@ -190,7 +190,7 @@ describe('Deploy to ECS', () => {
190190

191191
await run();
192192
expect(core.setFailed).toHaveBeenCalledTimes(0);
193-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
193+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
194194
});
195195

196196
test('cleans empty arrays out of the task definition contents', async () => {
@@ -204,7 +204,7 @@ describe('Deploy to ECS', () => {
204204

205205
await run();
206206
expect(core.setFailed).toHaveBeenCalledTimes(0);
207-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
207+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
208208
});
209209

210210
test('cleans empty strings and objects out of the task definition contents', async () => {
@@ -269,7 +269,7 @@ describe('Deploy to ECS', () => {
269269
}]
270270
}
271271
],
272-
requiresCompatibilities: [ 'EC2' ]
272+
requiresCompatibilities: ['EC2']
273273
});
274274
});
275275

@@ -365,7 +365,7 @@ describe('Deploy to ECS', () => {
365365
}]
366366
}
367367
],
368-
requiresCompatibilities: [ 'EC2' ],
368+
requiresCompatibilities: ['EC2'],
369369
proxyConfiguration: {
370370
type: "APPMESH",
371371
containerName: "envoy",
@@ -418,7 +418,7 @@ describe('Deploy to ECS', () => {
418418

419419
await run();
420420
expect(core.setFailed).toHaveBeenCalledTimes(0);
421-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
421+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
422422
});
423423

424424
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', () => {
444444
await run();
445445
expect(core.setFailed).toHaveBeenCalledTimes(0);
446446

447-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
447+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
448448
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
449449
expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, {
450450
cluster: 'cluster-789',
@@ -457,21 +457,21 @@ describe('Deploy to ECS', () => {
457457
revision: {
458458
revisionType: 'AppSpecContent',
459459
appSpecContent: {
460-
content: JSON.stringify({
461-
Resources: [{
462-
TargetService: {
463-
Type: 'AWS::ECS::Service',
464-
Properties: {
465-
TaskDefinition: 'task:def:arn',
466-
LoadBalancerInfo: {
467-
ContainerName: "web",
468-
ContainerPort: 80
460+
content: JSON.stringify({
461+
Resources: [{
462+
TargetService: {
463+
Type: 'AWS::ECS::Service',
464+
Properties: {
465+
TaskDefinition: 'task:def:arn',
466+
LoadBalancerInfo: {
467+
ContainerName: "web",
468+
ContainerPort: 80
469+
}
469470
}
470-
}
471-
}
472-
}]
471+
}
472+
}]
473473
}),
474-
sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
474+
sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
475475
}
476476
}
477477
});
@@ -522,7 +522,7 @@ describe('Deploy to ECS', () => {
522522
await run();
523523
expect(core.setFailed).toHaveBeenCalledTimes(0);
524524

525-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
525+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
526526
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
527527
expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, {
528528
cluster: 'cluster-789',
@@ -535,21 +535,21 @@ describe('Deploy to ECS', () => {
535535
revision: {
536536
revisionType: 'AppSpecContent',
537537
appSpecContent: {
538-
content: JSON.stringify({
539-
Resources: [{
540-
TargetService: {
541-
Type: 'AWS::ECS::Service',
542-
Properties: {
543-
TaskDefinition: 'task:def:arn',
544-
LoadBalancerInfo: {
545-
ContainerName: "web",
546-
ContainerPort: 80
538+
content: JSON.stringify({
539+
Resources: [{
540+
TargetService: {
541+
Type: 'AWS::ECS::Service',
542+
Properties: {
543+
TaskDefinition: 'task:def:arn',
544+
LoadBalancerInfo: {
545+
ContainerName: "web",
546+
ContainerPort: 80
547+
}
547548
}
548-
}
549-
}
550-
}]
549+
}
550+
}]
551551
}),
552-
sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
552+
sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
553553
}
554554
}
555555
});
@@ -598,7 +598,7 @@ describe('Deploy to ECS', () => {
598598
await run();
599599
expect(core.setFailed).toHaveBeenCalledTimes(0);
600600

601-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
601+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
602602
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
603603
expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, {
604604
cluster: 'cluster-789',
@@ -611,21 +611,21 @@ describe('Deploy to ECS', () => {
611611
revision: {
612612
revisionType: 'AppSpecContent',
613613
appSpecContent: {
614-
content: JSON.stringify({
615-
Resources: [{
616-
TargetService: {
617-
Type: 'AWS::ECS::Service',
618-
Properties: {
619-
TaskDefinition: 'task:def:arn',
620-
LoadBalancerInfo: {
621-
ContainerName: "web",
622-
ContainerPort: 80
614+
content: JSON.stringify({
615+
Resources: [{
616+
TargetService: {
617+
Type: 'AWS::ECS::Service',
618+
Properties: {
619+
TaskDefinition: 'task:def:arn',
620+
LoadBalancerInfo: {
621+
ContainerName: "web",
622+
ContainerPort: 80
623+
}
623624
}
624-
}
625-
}
626-
}]
625+
}
626+
}]
627627
}),
628-
sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
628+
sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
629629
}
630630
}
631631
});
@@ -726,7 +726,7 @@ describe('Deploy to ECS', () => {
726726
await run();
727727
expect(core.setFailed).toHaveBeenCalledTimes(0);
728728

729-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
729+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
730730
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
731731
expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, {
732732
cluster: 'cluster-789',
@@ -739,21 +739,21 @@ describe('Deploy to ECS', () => {
739739
revision: {
740740
revisionType: 'AppSpecContent',
741741
appSpecContent: {
742-
content: JSON.stringify({
743-
Resources: [{
744-
TargetService: {
745-
Type: 'AWS::ECS::Service',
746-
Properties: {
747-
TaskDefinition: 'task:def:arn',
748-
LoadBalancerInfo: {
749-
ContainerName: "web",
750-
ContainerPort: 80
742+
content: JSON.stringify({
743+
Resources: [{
744+
TargetService: {
745+
Type: 'AWS::ECS::Service',
746+
Properties: {
747+
TaskDefinition: 'task:def:arn',
748+
LoadBalancerInfo: {
749+
ContainerName: "web",
750+
ContainerPort: 80
751+
}
751752
}
752-
}
753-
}
754-
}]
753+
}
754+
}]
755755
}),
756-
sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
756+
sha256: '0911d1e99f48b492e238d1284d8ddb805382d33e1d1fc74ffadf37d8b7e6d096'
757757
}
758758
}
759759
});
@@ -793,7 +793,7 @@ describe('Deploy to ECS', () => {
793793
await run();
794794
expect(core.setFailed).toHaveBeenCalledTimes(0);
795795

796-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
796+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
797797
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
798798
expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, {
799799
cluster: 'cluster-789',
@@ -866,7 +866,7 @@ describe('Deploy to ECS', () => {
866866
await run();
867867
expect(core.setFailed).toHaveBeenCalledTimes(0);
868868

869-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family-absolute-path'});
869+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family-absolute-path' });
870870
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
871871
});
872872

@@ -882,7 +882,7 @@ describe('Deploy to ECS', () => {
882882
await run();
883883
expect(core.setFailed).toHaveBeenCalledTimes(0);
884884

885-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
885+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
886886
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
887887
expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, {
888888
cluster: 'cluster-789',
@@ -921,7 +921,7 @@ describe('Deploy to ECS', () => {
921921
await run();
922922
expect(core.setFailed).toHaveBeenCalledTimes(0);
923923

924-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
924+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
925925
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
926926
expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, {
927927
cluster: 'cluster-789',
@@ -960,7 +960,7 @@ describe('Deploy to ECS', () => {
960960
await run();
961961
expect(core.setFailed).toHaveBeenCalledTimes(0);
962962

963-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
963+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
964964
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
965965
expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, {
966966
cluster: 'cluster-789',
@@ -1000,7 +1000,7 @@ describe('Deploy to ECS', () => {
10001000
await run();
10011001
expect(core.setFailed).toHaveBeenCalledTimes(0);
10021002

1003-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
1003+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
10041004
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
10051005
expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, {
10061006
cluster: 'cluster-789',
@@ -1025,7 +1025,7 @@ describe('Deploy to ECS', () => {
10251025
await run();
10261026
expect(core.setFailed).toHaveBeenCalledTimes(0);
10271027

1028-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
1028+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
10291029
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
10301030
expect(mockEcsDescribeServices).toHaveBeenNthCalledWith(1, {
10311031
cluster: 'default',
@@ -1047,7 +1047,7 @@ describe('Deploy to ECS', () => {
10471047
await run();
10481048
expect(core.setFailed).toHaveBeenCalledTimes(0);
10491049

1050-
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family'});
1050+
expect(mockEcsRegisterTaskDef).toHaveBeenNthCalledWith(1, { family: 'task-def-family' });
10511051
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition-arn', 'task:def:arn');
10521052
expect(mockEcsDescribeServices).toHaveBeenCalledTimes(0);
10531053
expect(mockEcsUpdateService).toHaveBeenCalledTimes(0);
@@ -1132,4 +1132,4 @@ describe('Deploy to ECS', () => {
11321132
expect(core.setFailed).toHaveBeenNthCalledWith(1, 'Failed to register task definition in ECS: Could not parse');
11331133
expect(core.setFailed).toHaveBeenNthCalledWith(2, 'Could not parse');
11341134
});
1135-
});
1135+
});

0 commit comments

Comments
 (0)