actions / runner-container-hooks

Runner Container Hooks for GitHub Actions
MIT License
67 stars 43 forks source link

Redundant copy of externals folder #80

Closed collinmurd closed 1 year ago

collinmurd commented 1 year ago

Hi,

I'm using the latest version of k8s hook alongside the latest Actions Runner Controller (0.27.4).

I was running into an issue where the hook was taking ~2.5 minutes to spin up a Pod for the job. I tracked the bottleneck back to here where it's copying the externals directory (which contains the node runtimes) from the root runner directory to the current job's workspace. A recursive copy was taking a lot of time because of the node_modules included in each runtime directory (using the default summerwind/actions-runner:latest image).

This copy seems to be redundant. That externals directory is copied to the job workspace before the prepare_job hook is triggered. I've forked this hook and removed that copyExternalsToRoot function call, and it works as expected with no delay.

I'm using the default runner working directory (runner/_work). Is that step there to account for using a non-default working directory? If so, can the hook check to see if the externals directory is present before performing the copy and overwriting it all?

collinmurd commented 1 year ago

Oh, nevermind. Spoke too soon.

I see now that it's just a link to the externals. You need to copy it so that it gets onto the worker volume that the workflow Pod will mount.