More on GitLab Custom Executors

If you are trouble visualizing how GitLab Custom Executors Work, here is a diagram that might help.

A block diagram showing a setup for using GitLab CI to spawn KVM VMs on demand.

I recently wrote about spawning KVM VMs like Docker Containers using GitLab CI. My friend was trying to replicate what I was doing and was having some issues visualizing it all. There are a lot of moving parts to keep track of. To help him out, I made the above diagram. Hopefully some of you find it useful.

One thing to note, that the diagram doesn't show is that you can set the KVM host runner to accept multiple concurrent jobs in the runner config and then you can have multiple spawned VMs running jobs at once. For diagramming purposes it was easier to just show one VM.

Other use cases

As I started writing this, I started thinking about other potential use cases, I came up with a couple:

  • Using another VM provider - Parallels, VMware, HyperV, etc
  • Launching AWS or some other cloud machines. Instead of using local VMs, you could launch VMs in the cloud.
  • If your job required your software to interact with other machines, ie some sort of database or webserver, you could modify the launch and cleanup scripts to have several machines running at once.

If you are interested in investigating those, a good place to start would be my GitLab repository, where I have my already modified version of the scripts or the official GitLab Custom Executor Help.

Need Help

Setting up CI/CD can be a challenge. As with any good challenge it also offers some rewards. It has drastically improved the way I write software. It is probably the single step change in my effectiveness as a developer that I've seen in my career. I can't imagine not using it anymore. If you would like help setting things up so you can get all those benefits, contact us. We are working hard on trying to make the benefits of CI/CD accessible to all and we'd love to talk to you.