Chapter 04Lesson 03~115 minutes

GitLab Runner Architecture, Registration, Runner Managers, Job Execution, and Lifecycle: Configuration, Design Choices, and Tradeoffs

Runner design is an infrastructure decision, not a YAML preference. This lesson compares GitLab-hosted with self-managed capacity, project/group/instance scope, tagged with untagged routing, and persistent with ephemeral workers. Each choice is tied to ownership, trust, blast radius, queue behavior, upgrade responsibility, evidence, and cost.

Design tradeoffsHosted vs self-managedScopeRoutingEphemeral workers

Learning objectives

  • Choose GitLab-hosted or self-managed runners according to infrastructure control, maintenance responsibility, isolation, compliance, and cost.
  • Choose project, group, or instance scope according to the smallest set of repositories that actually require the capability.
  • Design tags and run_untagged policy as routing and trust controls rather than as informal labels.
  • Compare persistent managers/workers with ephemeral execution using residue risk, startup latency, observability, and operational complexity.
  • Define a Runner version/update policy that keeps major.minor compatibility with GitLab and records exact versions for reproducible evidence.
Design principle. Choose runner architecture from trust and workload boundaries first, then optimize convenience. A fast runner that gives untrusted code broad host/network/credential access is an infrastructure vulnerability, not a platform success.

1. GitLab-hosted versus self-managed runners

Dimension GitLab-hosted Self-managed
Operations GitLab manages infrastructure and scaling. You install, patch, monitor, secure, scale, and retire Runner infrastructure.
Control Limited infrastructure customization. Full control over network, executor, images, hardware, caches and locality.
Isolation Fresh managed compute per job according to hosted-runner model. Depends entirely on your executor and worker lifecycle.
Compliance / network May not reach private/internal resources by design. Can be placed in controlled network segments—but that increases blast radius if jobs are hostile.
Cost model Subject to GitLab compute policy/credits for applicable offerings. You own infrastructure and operational cost.

Use hosted runners when standard isolated compute meets the requirement and the organization wants low operational overhead. Use self-managed runners when workloads require controlled networks, special hardware, custom toolchains, data locality, or organizational policy—and budget for the resulting security/maintenance responsibility.

2. Project, group, and instance scope should follow the smallest legitimate audience

Need Preferred starting scope Reason
One repository needs a proprietary SDK Project runner Narrowest project/code exposure and easiest ownership.
A platform team serves a bounded product group Group runner Shared capability with group-level ownership and policy.
Generic isolated build capacity for many projects Instance runner / hosted capacity Broad service can be safe only when isolation and scheduling policy support multi-tenancy.

Escalating scope should be treated like escalating authorization. Before promoting a runner from project to group/instance use, review every host credential, network route, cache, executor setting, privileged capability, image policy, and cleanup assumption.

3. Tags form an AND expression, not a preference list

If a job requests multiple tags, an eligible runner must have every requested tag. This supports capability routing such as [linux, amd64, signed-build], but tags are only selectors. A tag named secure does not make the runner secure.

signed_build:
  tags:
    - linux
    - amd64
    - signed-build
  script:
    - ./build-and-sign-synthetic.sh

Keep tags stable, documented, and tied to concrete properties. Avoid personal names, ambiguous environment labels, or one-off tags that turn scheduling into tribal knowledge.

4. run_untagged and protected access control different populations

Run untagged determines whether jobs with no tag requirements may use the runner. Protected runner constrains eligible refs according to protected-ref rules. For sensitive deployment/signing runners, it is common to require both explicit tags and protected refs, plus isolated execution and narrow credentials.

Neither control alone protects a persistent Shell runner from trusted-but-buggy code. Routing policy decides who may arrive; executor/host isolation decides what the arriving code can affect.

5. Persistent managers and ephemeral workers solve different operational problems

Pattern Advantages Risks / cost
Persistent Shell/Docker host Low startup latency; simple local cache; easy debugging. Residue between jobs, patch drift, cross-project leakage, long-lived credentials, manual capacity management.
Persistent manager + ephemeral workers Central scheduling with per-job/short-lived compute isolation. More infrastructure/control-plane complexity; startup latency; external log persistence required.
Kubernetes/autoscaled fleet Elastic capacity and disposable pods/instances. Cluster/cloud permissions, autoscaler failure modes, cost bounds, network policy and observability become mandatory.

Chapter 05 covers executors and Chapter 30 covers fleets/autoscaling in depth. Here the design question is whether a worker should be trusted after running repository code. For untrusted or high-risk workloads, disposal/reimaging is usually safer than attempting perfect cleanup.

6. Version policy: compatibility is an operating requirement

GitLab Runner documentation recommends keeping Runner major.minor aligned with GitLab major.minor. Patch updates also matter because Runner is part of the attack surface and contains executor/network/cache implementations. A production policy should define:

  • supported Runner versions and update cadence;
  • staging/canary runner pool before broad rollout;
  • compatibility tests for executors/helper images/custom tooling;
  • recorded version/revision in incident evidence;
  • retirement criteria for stale or unsupported managers.
Current chapter pin: v19.3.1 is used for the disposable lab because it is the latest stable upstream Runner tag verified on 2026-09-11. Re-check before future course runs.

7. Reusing one runner configuration across managers is a fleet decision

The modern workflow permits multiple managers to register with one runner authentication token. That can be useful for horizontally scaled capacity, but it changes evidence and retirement:

  • record manager system_id, not only runner ID;
  • avoid baking a fixed system ID into reusable machine/container images;
  • know whether unregistering/deleting one manager affects other managers;
  • rotate authentication material through a controlled fleet procedure;
  • preserve per-manager logs externally when workers are ephemeral.

8. Worked decision table

Scenario Recommended starting point Why
Open-source lint/tests with no private network need GitLab-hosted runner Low maintenance and fresh managed compute.
One project needs internal license server Project self-managed runner, isolated network segment Minimize project and network blast radius.
Five projects need same ARM hardware Group runner with explicit ARM tag and controlled membership Share specialized capacity within a bounded audience.
Signing release artifacts Dedicated protected/tagged runner or isolated ephemeral signing worker Separate high-value credentials/capability from normal test workloads.
Untrusted fork workloads Fresh isolated compute with no protected credentials/network reach Persistent Shell/shared privileged runners create unacceptable cross-job risk.

9. Queue time, isolation, and cost are coupled

A single small runner may be cheap but create long queues; an oversized fleet may idle expensively. Do not optimize only job duration. Measure queue time, runner utilization, startup latency, cache/network overhead, and failure rate. Capacity planning comes later in Chapter 30, but the architecture chosen now determines which metrics and scaling levers are available.

Never solve queue pressure by broadening a sensitive runner’s scope or enabling untagged jobs unless the resulting trust expansion is explicitly approved.

10. Minimal production runner record

  • Owner/team and purpose.
  • Runner ID, scope, tags, run_untagged, protected/pause policy.
  • Manager deployment model, system IDs, Runner version/revision, executor.
  • Network destinations and denied network zones.
  • Credential sources available to jobs.
  • Cache/artifact storage and cleanup behavior.
  • Update/rotation/de-registration process.
  • Monitoring/log-retention and incident contact.
  • Expected projects/refs/workload trust level.
Next lesson

Diagnostics, Failure Modes, Security, and Performance

Use runner/job evidence to distinguish eligibility problems, manager outages, token incidents, scope mistakes, and residue before attempting repair.

Knowledge check

Why is a project runner often safer than a group runner for a one-project proprietary capability?

Does a secure tag provide isolation?

Why can persistent runners be dangerous across projects?

When is multiple-manager registration useful?

Why should Runner major.minor generally track GitLab major.minor?

Official references and version notes

  • Runners — runner categories, job scheduling, GitLab-hosted versus self-managed runners, and execution flow.
  • Manage runners — project/group/instance scope, creation workflow, ownership and pause/resume operations.
  • Configure runners — tags, run_untagged, protected runners, authentication-token rotation, and routing behavior.
  • Registering runners and new runner creation workflow — current runner authentication-token registration and deprecated legacy registration-token behavior.
  • GitLab Runner commands — register, list, verify, run, stop, and unregister lifecycle commands.
  • Runner fleet planning — manager system_id identity and modern unregister/delete distinctions.
  • Runners API — runner details, managers, status, pause, job history, authentication-token reset, and deletion semantics.
  • Security for self-managed runners — remote-code-execution trust, Shell executor risk, persistent-runner residue, isolation, and credential exposure.
  • GitLab Runner documentation — current compatibility guidance recommends keeping Runner major.minor aligned with GitLab; GitLab.com users should keep self-managed runners current.
Version and compatibility note

Version-sensitive statements were rechecked against current primary GitLab documentation and the GitLab Runner release history on 2026-09-11. The latest stable Runner tag visible in the upstream release history at that verification point is v19.3.1 (2026-08-24); GitLab 19.4 is scheduled after this guide-authoring date, so executable examples pin gitlab/gitlab-runner:v19.3.1 instead of a moving latest tag. The legacy runner-registration-token workflow is deprecated and scheduled for removal in GitLab 20.0; this chapter uses runner authentication tokens and the modern creation workflow.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0 Send only Ethereum/ERC-20 compatible assets to this address.