game-ci / unity-test-runner

Run tests for any Unity project
https://github.com/marketplace/actions/unity-test-runner
MIT License
205 stars 135 forks source link

Does not clean up created docker containers after timeout/cancellation #197

Closed mikz closed 1 year ago

mikz commented 1 year ago

Bug description

The containers created by this action are not cleaned up when the action is terminated either by a timeout or by concurrent workflow.

How to reproduce

Start a workflow with this action and terminate it when it is running this action and created a docker container.

Expected behavior

It should kill created docker containers.

The action can use runs.post to do cleanup: https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runspost

docker run has --cidfile option, that should write the container id to a file, then the cleanup script can just check the file and docker kill the container.

I'll probably take a look at this at some point.

webbertakken commented 1 year ago

Yup! Spot on.

Thanks a lot for your report.

Basically what needs to happen is catch any errors from the docker run and handle them accordingly. Details can be found in the docker.ts file in the model folder.

mikz commented 1 year ago

In the end I went with the runs.post, since none of the nodejs first solutions worked for me. Opened #198. And I'll start using it on our project immediately.