stgraber / lxd-github-actions

Scripts to run Github Actions runners inside of LXD
Apache License 2.0
22 stars 8 forks source link

Reaching out about the lxd-github-actions-runner go implementation #1

Open rgl opened 2 years ago

rgl commented 2 years ago

Hi @stgraber, I've started playing with a Go implementation of a LXD runner at https://github.com/rgl/lxd-github-actions-runner (aka lxd-ghar).

Its still pretty much a PoC, and I'm using it to learn about lxc/lxd; right now it can:

I was able to use it to implement a amd64/arm64 workflow that uses Debian live-build to create a custom iso at https://github.com/rgl/tinkerbell-debian-osie/actions.

live-build uses deboostrap internally, and that seems to require me to enable lxc privileged mode and disable apparmor; since I've just started using lxc, I'm not really sure that such a privileged container is really needed, and would really appreciate your advice :-)

I would like to add the features you've mention in this repository README, like being able to maintain a pool of instances. I'm still unsure if this should be handled by systemd instead (if that is actually possible).

The current implementation is interacting with lxc/lxd by calling out the lxc process; do you think it would be better to use the https://pkg.go.dev/github.com/lxc/lxd/client library instead?

stgraber commented 2 years ago

Hey @rgl, sorry for the delay!

It's great to see someone picking up the idea of a proper Go daemon to handle this stuff!

I'd definitely strongly recommend using the native Go client library instead of dealing with sub-processes.

Though another thing that'd be worth noting is that long-running Exec sessions can be problematic. If LXD updates itself for one reason or another, all exec sessions will be terminated, potentially causing all those agents to disconnect or even builds to fail.

So using Exec sessions to look at what's going on in the instance or to run short lived commands is all good, LXD will in fact wait up to 5min when being updated for any such command to complete. But for long running processes, I'd strongly recommend setting up a proper systemd based service in the instance and then starting that instead.