Create a process that isn't killed with the job

Is there a way to purposefully spawn a background process that won’t be cleaned up at the end of the job? Jenkins uses env vars to keep track of its processes, so I’m able to mess with that to keep processes going in their CI, but I can’t figure out how GitHub runners keep track of processes.


Github hosted runners are VMs that are destroyed after the job ends, so there is no way to keep anything running there.

If you just mean starting a process in one step and using it in other steps of the same job, regular services should do. I haven’t tried interacting with the init system in hosted runners yet, but starting Docker containers works just fine.

I should have specified, this is with a self hosted runner.

Figured this out, it actually does the same thing as Jenkins, I was just grabbing the env vars wrong. The runner uses the env var RUNNER_TRACKING_ID to keep track of processes. If this is overwritten, the runner won’t clean up the process.

1 Like