Github Actions Step freezes with Successful 0 Code

Summary:

I’m running into a problem where my containers are working perfectly and one(assignment_agent) closes after it does its job and returns a 0(successful) status. For some reason github actions thinks its not a success and does not continue to the next step and just times out after 6 hours. I’m not seeing anything in the debug logs that would indicate a failure

Logs:

2021-10-16T19:40:04.8152252Z e[35mtarget_2_1  |e[0m client connected
2021-10-16T19:40:04.8246382Z e[33msplitter_1  |e[0m Connected to  { host: 'target_1', port: 9997 }
2021-10-16T19:40:04.8261183Z e[33msplitter_1  |e[0m Connected to  { host: 'target_2', port: 9997 }
2021-10-16T19:40:05.3824485Z e[36mcriblassessment_agent_1 exited with code 0
2021-10-17T01:39:34.4743064Z ##[debug]Re-evaluate condition on job cancellation for step: 'Bring up target,splitter, and agent containers'.
2021-10-17T01:39:47.0086229Z ##[error]The operation was canceled.
2021-10-17T01:39:47.0098681Z ##[debug]System.OperationCanceledException: The operation was canceled.
2021-10-17T01:39:47.0119744Z ##[debug]Finishing: Bring up target,splitter, and agent containers
2021-10-17T01:39:47.0126348Z ##[debug]Evaluating condition for step: 'Retrieve data from containers'
2021-10-17T01:39:47.0130187Z ##[debug]Evaluating: success()
2021-10-17T01:39:47.0130852Z ##[debug]Evaluating success:
2021-10-17T01:39:47.0131788Z ##[debug]=> false
2021-10-17T01:39:47.0132414Z ##[debug]Result: false

Github Actions Workflow:

The log shows that the step gets canceled due to timeout. The step runs docker-compose up, which won’t terminate until the containers shut down. That doesn’t happen, so the job gets canceled after reaching the maximum allowed run time for a job.

The steps after look like they expect to interact with the containers and then stop them. To do that, start the containers in the background with docker-compose up -d (see docker-compose up | Docker Documentation).

From my own experience I recommend adding a docker-compose logs step right before shutting down the containers. Both that and the shutdown should run even if a previous step fails (see if: always()).

Thank you!! This solved my issue. I appreciate the help!

1 Like