You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2
Original file line number
Diff line number
Diff line change
@@ -226,6 +226,8 @@ The minimal permissions require access to CodeDeploy:
226
226
227
227
This action emits debug logs to help troubleshoot deployment failures. To see the debug logs, create a secret named `ACTIONS_STEP_DEBUG` with value `true` in your repository.
228
228
229
+
The input `show-service-events` helps you to check logs from the service deployment events without going to the AWS console. This is just for the `ECS deployment controller`. Is desirable to configure [deployment circuit breaker](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-circuit-breaker.html) to get a 'FAILED' rolloutState.
230
+
229
231
## License Summary
230
232
231
233
This code is made available under the MIT license.
Copy file name to clipboardExpand all lines: action.yml
+6
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,12 @@ inputs:
13
13
cluster:
14
14
description: "The name of the ECS service's cluster. Will default to the 'default' cluster"
15
15
required: false
16
+
show-service-events:
17
+
description: "Whether to see or not the service deployment events when deployment rolloutState is 'FAILED'. Useful to see errors when a deployment fails."
18
+
required: false
19
+
show-service-events-frequency:
20
+
description: "The frequency for showing a log line of the service events (default: 15 seconds)."
21
+
required: false
16
22
wait-for-service-stability:
17
23
description: 'Whether to wait for the ECS service to reach stable state after deploying the new task definition. Valid value is "true". Will default to not waiting.'
let describeResponse = await ecs.describeServices({
55
+
services: [service],
56
+
cluster: clusterName
57
+
}).promise();
40
58
41
-
core.info(`Deployment started. Watch this deployment's progress in the Amazon ECS console: https://${consoleHostname}/ecs/home?region=${aws.config.region}#/clusters/${clusterName}/services/${service}/events`);
59
+
let serviceResponse = describeResponse.services[0];
60
+
let rolloutState = serviceResponse.deployments[0].rolloutState;
61
+
let rolloutStateReason = serviceResponse.deployments[0].rolloutStateReason;
62
+
let failedTasksCount = serviceResponse.deployments[0].failedTasks;
63
+
let indexEventContainDeployDate = getPosition(deployTime.toString(), serviceResponse.events);
let describeTaskResponse = await ecs.describeTasks({
80
+
tasks: [tasksList.taskArns[0]],
81
+
cluster: clusterName,
82
+
}).promise();
83
+
let stopCode = describeTaskResponse.tasks[0].stopCode;
84
+
let stoppedReason = describeTaskResponse.tasks[0].stoppedReason;
85
+
core.info(`Task status: ${stopCode}. The reason is: ${stoppedReason}.`);
86
+
throw new Error(`There are failed tasks. This means the deployment didn't go well. Please check the logs of task, service or container for more information.`);
core.info(`Deployment started. Watch this deployment's progress in the Amazon ECS console: https://${consoleHostname}/ecs/home?region=${aws.config.region}#/clusters/${clusterName}/services/${service}/events`);
92
+
}
42
93
43
94
// Wait for service stability
44
95
if (waitForService && waitForService.toLowerCase() === 'true') {
core.info(`Deployment started. Watch this deployment's progress in the Amazon ECS console: https://${consoleHostname}/ecs/home?region=${aws.config.region}#/clusters/${clusterName}/services/${service}/events`);
core.info(`Task status: ${stopCode}. The reason is: ${stoppedReason}.`);
81
+
if(containerLastStatus=='STOPPED'){
82
+
core.info(`Container status: ${containerLastStatus}. The reason is: ${describeTaskResponse.tasks[0].containers[0].reason}.`);
83
+
}
84
+
thrownewError(`There are failed tasks. This means the deployment didn't go well. Please check the logs of task, service or container for more information.`);
core.info(`Deployment started. Watch this deployment's progress in the Amazon ECS console: https://${consoleHostname}/ecs/home?region=${aws.config.region}#/clusters/${clusterName}/services/${service}/events`);
0 commit comments