Skip to main content
Run each CI job on a VM deployed for that job, and delete the VM when the job ends. Every build then starts from the same image, nothing one job leaves behind affects the next, and the node’s CPU and memory go back to the pool as soon as the job is done.

Deploy at the start, delete at the end

Orka’s CI integrations deploy and delete VMs for you. The GitHub Actions runner tears down each runner VM after its job. The Jenkins plugin’s ephemeral agent pool deletes a VM after an idle period, so one VM can run more than one build before it’s deleted. If you script it yourself, delete the VM even when the job fails or is canceled:
If your CI tool runs cleanup separately from the job’s script, put the delete there instead, for example a step with if: always() in GitHub Actions, after_script in GitLab CI, or a pre-exit hook in Buildkite. Name each VM after its job, such as ci-<JOB_ID>, so a VM that outlives its job can be traced back to it.

Don’t keep VMs between jobs

It can be tempting to keep a warm VM around and reuse it. Avoid it:
  • Its disk is temporary. If a node goes down for more than a few minutes, Orka deploys the VM again from its original image, and anything you changed inside it is gone. See What happens if a node goes down?.
  • It holds capacity. A running VM keeps its CPU and memory on the node while it waits for work, and each node runs at most two macOS VMs.
  • It drifts. Each job leaves files, caches, and processes behind, so later jobs don’t run on the image you tested.
If jobs need something that’s slow to set up, such as Xcode, toolchains, or dependencies, put it in the image you deploy from, and push a new version of the image when it changes. See How do you keep changes you make inside a VM?.

Clean up leftover VMs

A job that’s killed outright, for example when its CI agent crashes, can skip its cleanup. Check now and then for CI VMs whose jobs have finished, and delete them:
A consistent name prefix like ci- makes them easy to spot.