actions / runner

The Runner for GitHub Actions :rocket:
https://github.com/features/actions
MIT License
4.8k stars 940 forks source link

Support for execute cmd/scripts for cleanup on Complete Job #1143

Open dibenlloch opened 3 years ago

dibenlloch commented 3 years ago

Describe the enhancement Being able to execute scripts/commands on hosted machine for cleanup (remove files, change permisions, whatever...) on Complete Job phase, for example before Cleaning up orphan processes

This could be configured using config flags like "context.Global.Variables" to allow this option or setup command/script to execute.

Additional information For self-hosted runners if pipeline uses docker commands in all forms (containers, services, docker actions, docker run) that causes RW problems due creation of files with root ownership. Documented in other issues like https://github.com/actions/runner/issues/434 Solution of executing actions-runner as root also derivates on other problems. Ex: On nodejs some component like jest-runner can have problems using root privileges, that can causes that process "freezes" and job will end once we reach runner job time limit.

Other problems that we have with custom runners is that files are persisted between jobs if we don't do manual cleanups (checkout, rm step...). Being able to clean it at complete job could be nice.

On summary, if we are able to execute some bash script at end of job execution we can:

ethomson commented 2 years ago

Thanks for the feedback @dibenlloch - we need to improve runner execution in particular, and so I'll make sure that this is on the backlog.