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
@@ -326,6 +326,8 @@ To tag your tasks:
326
326
327
327
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.
328
328
329
+
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.
330
+
329
331
## License Summary
330
332
331
333
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
@@ -16,6 +16,12 @@ inputs:
16
16
cluster:
17
17
description: "The name of the ECS service's cluster. Will default to the 'default' cluster."
18
18
required: false
19
+
show-service-events:
20
+
description: "Whether to see or not the service deployment events when deployment rolloutState is 'FAILED'. Useful to see errors when a deployment fails."
21
+
required: false
22
+
show-service-events-frequency:
23
+
description: "The frequency for showing a log line of the service events (default: 15 seconds)."
24
+
required: false
19
25
wait-for-service-stability:
20
26
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({
174
+
services: [service],
175
+
cluster: clusterName
176
+
});
160
177
161
-
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}`);
178
+
let serviceResponse = describeResponse.services[0];
179
+
let rolloutState = serviceResponse.deployments[0].rolloutState;
180
+
let rolloutStateReason = serviceResponse.deployments[0].rolloutStateReason;
181
+
let failedTasksCount = serviceResponse.deployments[0].failedTasks;
182
+
let indexEventContainDeployDate = getPosition(deployTime.toString(), serviceResponse.events);
let describeTaskResponse = await ecs.describeTasks({
199
+
tasks: [tasksList.taskArns[0]],
200
+
cluster: clusterName,
201
+
});
202
+
let stopCode = describeTaskResponse.tasks[0].stopCode;
203
+
let stoppedReason = describeTaskResponse.tasks[0].stoppedReason;
204
+
let containerLastStatus = describeTaskResponse.tasks[0].containers[0].lastStatus;
205
+
core.info(`Task status: ${stopCode}. The reason is: ${stoppedReason}.`);
206
+
if (containerLastStatus == 'STOPPED') {
207
+
core.info(`Container status: ${containerLastStatus}. The reason is: ${describeTaskResponse.tasks[0].containers[0].reason}.`);
208
+
}
209
+
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://${region}.${consoleHostname}/ecs/v2/clusters/${clusterName}/services/${service}/events?region=${region}`);
216
+
}
162
217
163
218
// Wait for service stability
164
219
if (waitForService && waitForService.toLowerCase() === 'true') {
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}`);
core.info(`Task status: ${stopCode}. The reason is: ${stoppedReason}.`);
200
+
if(containerLastStatus=='STOPPED'){
201
+
core.info(`Container status: ${containerLastStatus}. The reason is: ${describeTaskResponse.tasks[0].containers[0].reason}.`);
202
+
}
203
+
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://${region}.${consoleHostname}/ecs/v2/clusters/${clusterName}/services/${service}/events?region=${region}`);
0 commit comments