actions / runner-container-hooks

Runner Container Hooks for GitHub Actions
MIT License
76 stars 46 forks source link

Add support for adding volumeMounts outside of the shared workdir on k8s #46

Closed nielstenboom closed 1 year ago

nielstenboom commented 1 year ago

Hey, thanks for the work on this project, we've recently switched to the Actions Runner Controller with some runners that use the containerMode: kubernetes and works well so far!

There is one thing that would be nice to have added, which is the functionality to in some way mount volumes to the spun up pod by this hook.

The use case for this is as follows: We have to run python tests on a machine that have a GPU, so we run our tests in a nvidia/cuda:11.3.1-devel-ubuntu18.04 container from a Github action. In this action a lot of packages get pulled from the internet and then installed. Today I wanted to add some caching for this by adding volumeMounts to the spun up pod, but after digging I found out that this does not seem possible (please correct me if I'm wrong, but I couldn't find a way).

Would it be possible to add support in some way to be able to mount other volumes to the pod that gets spun up?

Thanks!

nielstenboom commented 1 year ago

Did some more digging and found this related issue as well: https://github.com/actions/actions-runner-controller/issues/1730

nikola-jokic commented 1 year ago

Hey @nielstenboom,

Thank you for using runner container hooks! I'll try to dig into this issue as soon as I can. In the meantime, as long as you have a volume mounted to a pod that contains runner with k8s hooks, you can pass docker options providing volume mounts. That should be parsed by the runner and passed to the hook as userVolumeMounts. Then we use that to build a pod.

If you can provide an example setup (commands that you use to spin up runners in ARC). And please, don't forget to remove information that should not be visible :relaxed:

nikola-jokic commented 1 year ago

Thank you, @nielstenboom, for providing a great starting point! I will close this issue as it is part of the new release :relaxed: