Ephemeral GitHub Actions runners: one clean machine per job

Last updated

One job, one machine: the life of an ephemeral runner

The loop

1 / 4

A job is queued

Subscribe to the workflow_job webhook. GitHub documents it for this: "You can create your own autoscaling environment by using payloads received from the workflow_job webhook."

Read that part

2 / 4

A machine is created for it

On a queued event whose labels you serve, generate a JIT config and create a machine with it. The machine never holds a registration token, only a config valid for one runner.

Read that part

3 / 4

The runner takes one job

The machine runs run.sh --jitconfig, takes the job, and exits. JIT runners "perform at most one job before being automatically removed".

Read that part

4 / 4

The machine is deleted

Delete the machine, and remove the runner from GitHub if it is still registered. The next job starts on a clean machine.

Read that part

On flockvm

1 / 4

A job is queued

GitHub sends a workflow_job webhook for every job queued in a connected repository; flockvm checks its signature and queues the ones with runs-on: flockvm.

Read that part

2 / 4

A VM boots for it

When a slot is free, flockvm calls generate-jitconfig on your repository and boots a VM. The JIT config reaches the VM through its metadata service and is never written to a log.

Read that part

3 / 4

The runner takes one job

Inside the VM, the GitHub runner starts once with run.sh --jitconfig, takes the job and exits. Boot and registration take about 25 seconds, billed.

Read that part

4 / 4

The VM is deleted

flockvm deletes the VM and removes the runner from your repository if it is still registered. A VM is never reused, even for the next job of the same repository.

Read that part

The loop of "Building it yourself", then the same loop as flockvm runs it. flockvm's limits are real: at most 4 runner VMs at once on the host, across all organizations; Linux x64 only (Ubuntu 26.04); private repositories only; no cache between jobs; a 6-hour job timeout; no certification. GitHub's documentation, read on 8 November 2026.

An ephemeral GitHub Actions runner takes exactly one job, then is removed, and the machine it ran on is thrown away. The next job starts on a clean machine, so nothing one job leaves behind (files, Docker images, credentials, a planted process) reaches the next. You get one by registering a self-hosted runner with --ephemeral, by starting it from a just-in-time (JIT) configuration generated through GitHub's API, by running Actions Runner Controller (ARC) on Kubernetes, or by using a managed runner that creates a fresh VM per job.

Persistent self-hosted runner Ephemeral self-hosted runner
Jobs per runner Any number, one after another One
Machine between jobs The same: workspace, caches, processes carry over A new one for each job
Registration Once, with config.sh Per job: config.sh --ephemeral or a JIT config
Scaling Fixed fleet, sized for the peak Machines created on demand, from the workflow_job webhook
What a compromised job leaves Whatever it planted, for the next job Nothing, once the machine is deleted
What you run The machines The machines, plus an autoscaler that creates and deletes them

GitHub's own advice: "GitHub recommends implementing autoscaling with ephemeral self-hosted runners; autoscaling with persistent self-hosted runners is not recommended." GitHub's facts on this page were read on its documentation on 8 November 2026. flockvm sells ephemeral runners: we say how ours work and where they stop.

What is an ephemeral runner?

A runner is the GitHub Actions agent (actions/runner) running on a machine and registered with a repository, an organization or an enterprise. A persistent runner stays registered and takes job after job. An ephemeral one registers for a single job: "The GitHub Actions service will then automatically de-register the runner after it has processed one job."

"Ephemeral" covers the runner registration. Whether the machine is clean for the next job depends on what you do with it: a runner registered with --ephemeral on a long-lived server still leaves that server's disk, Docker images and processes behind. The pattern that gives a clean machine is one VM (or container) per job, created when the job is queued and deleted when it ends.

GitHub-hosted runners already work this way: "With the exception of single-CPU runners, each GitHub-hosted runner is a new virtual machine (VM) hosted by GitHub." The exception, ubuntu-slim, runs "inside a container rather than a full VM instance".

Why one job per machine matters

A persistent runner shares state across every job it takes, from every workflow and every branch allowed to use it:

  • Files and caches. The work folder, tool caches, ~/.npm, Docker images and build outputs of one job are there for the next. A poisoned cache or a modified binary affects every later build.
  • Credentials. A secret written to disk, a docker login config, a cloud CLI profile or an SSH key left by one job can be read by the next. GitHub notes that a secret passed as a command-line argument can be seen by another job on the same runner with ps x -w.
  • Processes. A job can start a background process that outlives it and watches what later jobs do.
  • Agent state. Coding agents that run in CI change the machine too. The openai/codex-action README warns that its user-account and socket changes "can outlive a job on reused self-hosted runners", and advises running that mode "on disposable runners".

The persistence case is not hypothetical. In the Shai-Hulud npm campaign of November 2025, as analysed by Sysdig, the malware registered infected machines as self-hosted runners with "the distinctive name, SHA1HULUD", then pushed a workflow that ran attacker commands on them. A machine that is deleted after one job cannot serve as that kind of foothold for long. Self-hosted runner security covers the rest of the threat model.

GitHub's secure-use guide sums it up: "Self-hosted runners for GitHub do not have guarantees around running in ephemeral clean virtual machines, and can be persistently compromised by untrusted code in a workflow."

What the next job finds on the machine

Persistent runner

One machine per job

Persistent runner The next job

A persistent runner shares state across every job it takes, from every workflow and every branch allowed to use it.

Persistent runner Files and caches

The work folder, tool caches, ~/.npm, Docker images and build outputs of one job are there for the next. A poisoned cache or a modified binary affects every later build.

Persistent runner Credentials

A secret written to disk, a docker login config, a cloud CLI profile or an SSH key left by one job can be read by the next.

Persistent runner Processes

A job can start a background process that outlives it and watches what later jobs do.

Persistent runner Agent state

Coding agents that run in CI change the machine too: the openai/codex-action README warns that its user-account and socket changes "can outlive a job on reused self-hosted runners".

Persistent runner The same machine

The same machine between jobs: workspace, caches, processes carry over. A compromised job leaves whatever it planted, for the next job.

One machine per job The next job

The next job starts on a clean machine, so nothing one job leaves behind (files, Docker images, credentials, a planted process) reaches the next.

One machine per job An ephemeral runner

"Ephemeral" covers the runner registration. A runner registered with --ephemeral on a long-lived server still leaves that server's disk, Docker images and processes behind.

One machine per job A new machine

The pattern that gives a clean machine is one VM (or container) per job, created when the job is queued and deleted when it ends.

Hatched: what one job leaves for the next. The four kinds of state are this section's list.

Three ways to get an ephemeral runner

1. config.sh --ephemeral

The simplest one: register the runner with the --ephemeral flag, and it de-registers after one job.

./config.sh \
  --url https://github.com/acme/api \
  --token "$REGISTRATION_TOKEN" \
  --labels linux-ephemeral \
  --ephemeral \
  --unattended
./run.sh        # takes one job, then exits

Wrap it in a script that deletes the VM or container when run.sh exits and creates a new one, and you have one machine per job. The machine needs a registration token, which can register further runners until it expires.

2. A just-in-time (JIT) configuration

A JIT runner skips config.sh. Your controller asks GitHub's REST API for a single-use configuration, and the runner starts with it. GitHub describes JIT runners as runners that "perform at most one job before being automatically removed from the repository, organization, or enterprise."

# On the controller, when a job is queued:
JIT=$(curl -sS -X POST \
  -H "Authorization: Bearer $GITHUB_TOKEN" \
  -H "Accept: application/vnd.github+json" \
  https://api.github.com/repos/acme/api/actions/runners/generate-jitconfig \
  -d '{"name": "job-8812", "runner_group_id": 1, "labels": ["self-hosted", "linux", "x64", "linux-ephemeral"]}' \
  | jq -r .encoded_jit_config)

# Inside the new machine:
./run.sh --jitconfig "$JIT"

The organization endpoint is POST /orgs/{org}/actions/runners/generate-jitconfig, with the same body. name, runner_group_id and labels are required, and the token needs admin access to the repository or organization. A GitHub App needs the repository permission "Administration" (write) for the repository endpoint, and the organization permission "Self-hosted runners" (write) for the organization one. The machine never holds a registration token, only a config valid for one runner: that is why JIT is the better choice for an autoscaler.

3. Actions Runner Controller (ARC) on Kubernetes

ARC is "a Kubernetes operator that orchestrates and scales self-hosted runners for GitHub Actions". Its runner scale sets create runner pods as jobs arrive, through an "EphemeralRunner" controller, and remove them after. The quickstart is two Helm charts:

helm install arc \
  --namespace arc-systems --create-namespace \
  oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set-controller

helm install arc-runner-set \
  --namespace arc-runners --create-namespace \
  --set githubConfigUrl="https://github.com/acme" \
  --set githubConfigSecret.github_token="$GITHUB_PAT" \
  oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set

Jobs then target the scale set by its name, runs-on: arc-runner-set. GitHub "only supports the latest Autoscaling Runner Sets version of ARC", and recommends "that organizations have staff with expert-level knowledge of container orchestration". Building images with Docker-in-Docker and image caching are outside GitHub Support's scope. For autoscaling without Kubernetes, GitHub also publishes the Runner Scale Set Client, "a standalone Go-based module" for building your own.

The three ways, side by side

The three ways, side by side
WayHow the runner registersWhat to know
--ephemeralA config.sh flag: it de-registers after one jobThe simplest one. The machine needs a registration token
JIT configurationA single-use configuration from GitHub's REST APIThe machine never holds a registration token
ARC on KubernetesRunner pods created as jobs arrive, removed afterGitHub recommends staff with expert-level knowledge of container orchestration
As this section describes them. GitHub's documentation, read on 8 November 2026.

Container per job or VM per job?

ARC gives each job a pod: a container on a node that runs other pods. Containers share the node's kernel, so a kernel exploit or a container escape reaches the node and everything on it, and in Docker-in-Docker mode, "the Docker-in-Docker container requires privileged mode". A VM per job gives each job its own guest kernel behind hardware virtualization. Firecracker microVMs were built for this kind of short, untrusted workload: they boot their own kernel with a small device model. MicroVM vs container goes through the difference, and Firecracker sandboxes through the technology.

For CI that only runs your own team's code, a container per job may be enough. For jobs that run code from many contributors, dependencies you don't review, or coding agents, the VM boundary is the safer default.

Building it yourself: what you have to run

The loop is short to describe:

  1. Subscribe to the workflow_job webhook. GitHub documents it for this: "You can create your own autoscaling environment by using payloads received from the workflow_job webhook."
  2. On a queued event whose labels you serve, generate a JIT config and create a machine with it.
  3. The machine runs run.sh --jitconfig, takes the job, and exits.
  4. Delete the machine, and remove the runner from GitHub if it is still registered.

What makes it a project, not a script:

  • Image updates. "If you do not perform a software update within 30 days, the GitHub Actions service will not queue jobs to your runner." Your base image needs a rebuild at each runner release.
  • Cleanup. A machine that dies mid-job leaves a registered runner and a running bill. Something has to find and remove both.
  • Webhooks. Deliveries can arrive twice or not at all; the controller has to be idempotent and reconcile with GitHub's job state.
  • Capacity. Quotas, a queue when they are reached, and someone on call when jobs pile up.
  • Boot time. Every job waits for a machine to boot and the runner to register.

Managed runners that give a fresh VM per job

Each of these registers its machines as self-hosted runners and changes one runs-on: label. On their own pages, read on 8 November 2026:

  • GitHub-hosted: a new VM per job, except the 1-core ubuntu-slim container.
  • Blacksmith: a Firecracker microVM per job, on its own bare-metal hardware, destroyed after.
  • Depot: ephemeral EC2 instances, never reused.
  • Namespace: a VM with its own kernel per job.
  • Ubicloud: a fresh VM per job.
  • WarpBuild: a fresh VM per job.
  • RunsOn, in your own AWS account: "Every job runs on an EC2 instance that no other job has used."
  • flockvm: a Firecracker microVM per job, in France (below).

They differ on price, platforms, regions and concurrency far more than on isolation: cheap GitHub Actions runners compares them on those.

How flockvm does it

flockvm runs the loop above for you, with one Firecracker microVM per job:

  1. GitHub sends a workflow_job webhook for every job queued in a connected repository, whatever its labels; flockvm checks its signature, ignores jobs that ask for no flockvm label, and queues the ones with runs-on: flockvm (or another flockvm label).
  2. When a slot is free, flockvm calls generate-jitconfig on your repository and boots a VM. The JIT config reaches the VM through its metadata service and is never written to a log.
  3. Inside the VM, the GitHub runner starts once with run.sh --jitconfig, takes the job and exits. Boot and registration take about 25 seconds, billed.
  4. flockvm deletes the VM and removes the runner from your repository if it is still registered. A VM is never reused, even for the next job of the same repository, and nobody can SSH into it.

The limits are real: at most 4 runner VMs at once on the host, across all organizations; Linux x64 only (Ubuntu 26.04); private repositories only; no cache between jobs; a 6-hour job timeout; no certification. It fits a small team's private Linux jobs at a third of GitHub's Linux x64 rate for the same vCPUs, counted by the second (pricing); it does not replace an ARC fleet that runs hundreds of jobs at once or reaches your private network. CI security has the details, and GitHub Actions runners on Firecracker the short version. Since every job starts on an empty VM, the caching fixes in how to speed up GitHub Actions matter more here than on a persistent runner.

FAQ

Are GitHub-hosted runners ephemeral?

Yes. "With the exception of single-CPU runners, each GitHub-hosted runner is a new virtual machine (VM) hosted by GitHub." The 1-core ubuntu-slim runner runs in a container instead.

What is a JIT runner in GitHub Actions?

A just-in-time runner starts from a single-use configuration that your code requests from POST /repos/{owner}/{repo}/actions/runners/generate-jitconfig (or the organization endpoint). It takes at most one job and is then removed. Unlike config.sh --ephemeral, the machine never needs a registration token.

What is the difference between --ephemeral and a JIT runner?

Both take one job. --ephemeral registers through config.sh with a registration token, on the machine. A JIT runner gets its configuration from the API, through the controller, and runs run.sh --jitconfig directly. Autoscalers, flockvm's included, generally use JIT.

Does ARC create ephemeral runners?

Yes. ARC's autoscaling runner sets, the only mode GitHub supports, create ephemeral runner pods as jobs arrive and remove them after. Each pod is a container on a shared Kubernetes node, not a VM.

Do ephemeral runners make CI slower?

Each job pays for a fresh machine: a boot and a runner registration, and caches that start empty. Restore dependencies with actions/cache or the cache: input of setup-* actions, and use a registry cache for Docker layers.

Run your agents in their own microVMs

flockvm gives each coding agent a Firecracker microVM that pauses with its memory and resumes, billed per second. France is live, and you can start with a 7-day free trial.

Start your 7-day free trial

Card required. Nothing charged for 7 days.