What are self-hosted runners?
Understanding self-hosted CI/CD runners and when to use them
Self-hosted runners are compute instances that you manage and maintain, used to execute CI/CD workflows and pipelines. Unlike cloud-hosted runners provided by CI/CD platforms, self-hosted runners run on your own infrastructure.
How self-hosted runners work#
When you configure a self-hosted runner, it connects to your CI/CD platform and waits for jobs to execute. When a workflow or pipeline triggers a job that's configured to run on your self-hosted runner, the platform sends the job to your runner, which executes it and reports the results back to the platform.
1┌─────────────────┐2│ Your Platform │ GitHub Actions, GitLab, Jenkins, etc.3│ (GitHub, etc.) │4└────────┬────────┘5 │ Sends jobs6 │7┌────────▼────────────────┐8│ Self-Hosted Runner │9│ (Your Infrastructure) │10│ │11│ ┌───────────────────┐ │12│ │ Execute Job │ │13│ │ - Run tests │ │14│ │ - Build artifacts │ │15│ │ - Deploy app │ │16│ └───────────────────┘ │17└────────┬────────────────┘18 │ Reports results19 │20┌────────▼────────────┐21│ Platform Dashboard │22│ (View results) │23└─────────────────────┘Cloud-hosted vs self-hosted runners#
| Aspect | Cloud-hosted runners | Self-hosted runners |
|---|---|---|
| Setup | Instant, no configuration | Requires server setup and configuration |
| Cost | Per-minute billing | Fixed infrastructure cost |
| Customization | Limited options | Complete control |
| Maintenance | Managed by platform | Your responsibility |
| Performance | Varies by location | Depends on your hardware |
| Security | Platform managed | Your responsibility |
| Network | Public internet | Private network possible |
| Timeout | Usually 6 hours | Configurable or unlimited |
When to use self-hosted runners#
Good for self-hosted runners:
- Long-running jobs (>6 hours) that exceed cloud-hosted timeouts
- Resource-intensive workloads (compilation, video processing, ML training)
- Private networks with strict security requirements
- Cost optimization for frequent CI/CD runs
- Custom tooling requiring specific software or configurations
- High-performance needs requiring dedicated hardware
- Compliance requirements mandating on-premises execution
- Air-gapped environments without internet connectivity
Better with cloud-hosted runners:
- Quick tests with simple requirements
- Open-source projects with unpredictable workload
- Minimal maintenance desired
- Scaling up and down based on demand
- Multi-platform builds needing various OS support
Key concepts#
Runner (or Agent)#
The software running on your infrastructure that connects to your CI/CD platform and executes jobs.
Compute Instance#
The server or computer that runs the self-hosted runner software. Can be physical hardware, VM, or container.
Job#
A set of steps that run on a single runner instance as part of a workflow or pipeline.
Executor (GitLab) / Executors (Jenkins)#
The method used to execute jobs (e.g., shell, Docker, Kubernetes).
Registration#
The process of connecting a runner to your CI/CD platform, establishing trust and credentials.
Labels / Tags#
Identifiers used to route specific jobs to specific runners based on capabilities.
Getting started with self-hosted runners#
- Choose your platform - GitHub Actions, GitLab, Jenkins, or another CI/CD system
- Prepare infrastructure - Physical server, VM, cloud instance, or container
- Install runner software - Download and install the runner agent
- Register runner - Connect it to your CI/CD platform
- Configure settings - Labels, tags, and job policies
- Run first job - Test with a simple workflow or pipeline
- Iterate and optimize - Add more runners, optimize for performance
Next steps#
- Choose a platform - Compare GitHub Actions, GitLab, Jenkins, and others
- Secure your runners - Best practices for security