3

We need to use the Github action self-hosted runner because we need to have an access to the on-premises resource.

I understand that we can run the self-hosted runner on VM or the docker container.

Can we run the self-hosted runner on-demand? Like the Github-hosted runner that always use the clean isolated VM and is destroyed at the end of job execution. Or like the job agents on Azure DevOps/Github that created the clean job agent container to run the pipeline and gets deleted at the end.

Can we do something similar with Gihub-action self-hosted runner? E.g. Allow us to register a VM with the Docker engine or Kubernetes cluster as a self-hosted runner. When I run the Github workflow, it should start a container and run the workflow inside that container. After that, it should delete the container.

Is it possible to do that now? I am not sure if there is a roadmap document somewhere for Github action.

Michael Sync
  • 4,834
  • 10
  • 40
  • 58

2 Answers2

2

If you use AWS, you can try ec2-github-runner. It does exactly what you're looking for.

I believe the same approach can also be implemented for the other cloud providers.

GitHub itself doesn't provide such capabilities at the moment.

Volodymyr Machula
  • 1,564
  • 1
  • 15
  • 20
  • this is pretty cool, and you can also get the same concept to work with a Windows Docker container... if you want to keep your host online, run lots of jobs on it efficiently, and save a ton of $$$ if you have a busy queue. – Erik Aronesty Apr 06 '21 at 13:46
0

I think the question is a little bit misleading but, if I understand properly, what you are trying to achieve is to have stateless GitHub Actions workflow run execution in your self-hosted runner. Unfortunately, this is currently impossible. Only GitHub-hosted runners work the way you describe. According to the documentation:

GitHub-hosted runner is always a clean isolated virtual machine, and it is destroyed at the end of the job execution.

You can read more about the differences between each runner type here.

Marcin Kłopotek
  • 5,271
  • 4
  • 31
  • 51
  • Thanks, Marcin. How do I improve my question? Yes. You understand it right. I want to span up a new clean container on my self-hosted runner VM to run the workflow. and want to delete it after the execution. I am aware that GitHub-hosted runner does that. If you look at Azure DevOps or Gitlab, the runners are a clean container and it got destroyed after the execution. I am looking for a way to do the same with the self-hosted runner. – Michael Sync Nov 17 '20 at 11:01
  • Maybe you want to checkout https://github.com/evryfs/github-actions-runner-operator ? – David Karlsen Feb 28 '21 at 23:22