Runner Groups Management
Earn 25 points (50 with Pro) in two steps
- ① Read through the lesson — each section gets a ✓ as you scroll through it.
- ② When every section has a ✓, tap Complete lesson.
0 of 10 read · keep scrolling
✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro
Lesson: Mastering GitHub Runner Groups at Scale
Introduction: The Architecture of Enterprise Automation
In the context of modern software development, GitHub Actions has become the standard for CI/CD pipelines. However, as an organization grows from a single repository to an enterprise-wide ecosystem, the default "shared runner" model—where every repository uses the same pool of runners—quickly becomes inadequate. Security, compliance, and resource isolation become critical concerns. This is where Runner Groups come into play.
Runner Groups are a fundamental organizational tool in GitHub Enterprise. They allow administrators to partition self-hosted runners into logical sets, providing granular control over which repositories or organizations can access specific compute resources. Without runner groups, you risk "noisy neighbor" scenarios where one heavy-duty project consumes all available runners, stalling critical deployments for other teams. Furthermore, you lose the ability to enforce security boundaries, such as ensuring that only production-ready code runs on hardened, high-security infrastructure.
Understanding how to manage these groups at scale is not just about keeping the lights on; it is about building a predictable, performant, and secure automation platform for your entire engineering organization. In this lesson, we will explore the lifecycle of runner groups, the policy enforcement mechanisms behind them, and the operational strategies required to manage them effectively across thousands of repositories.
Not read yet
The Fundamentals of Runner Groups
At its core, a runner group is a container for self-hosted runners. When you register a self-hosted runner with GitHub, it is assigned to the "Default" group unless otherwise specified. By creating custom groups, you can apply access policies that dictate which repositories or organizations are allowed to use those runners.
Why You Need Runner Groups
Managing runners without groups is like running an office where everyone shares the same desk. It works for a small team, but it creates chaos as you scale. Runner groups provide three primary benefits:
- Access Control: You can restrict runners to specific repositories, ensuring that sensitive projects (like financial or security-critical applications) run only on dedicated, audited hardware.
- Resource Isolation: You can prevent a team running massive machine-learning workloads from exhausting the runner capacity needed by a team running lightweight unit tests.
- Governance: You can enforce naming conventions and group-level settings that ensure all runners in a specific group follow the same security protocols, such as required ephemeral cleanup or specific network egress rules.
Callout: Runner Groups vs. Labels It is common to confuse Runner Groups with Runner Labels. Think of Runner Groups as the "security and access boundary," while Runner Labels are the "capability descriptor." You use Groups to decide who can access the hardware, and you use Labels to decide what the hardware can do (e.g.,
gpu-enabled,ubuntu-latest,high-memory). You cannot use labels to restrict access; you must use groups for that.
Not read yet
Planning Your Runner Group Strategy
Before you start creating groups, you need a strategy. Most enterprises find success by aligning runner groups with their organizational structure or their risk profile. Here are common strategies used by high-performing engineering teams:
- Environment-Based Groups: Create separate groups for
Development,Staging, andProduction. This ensures that production jobs never compete with experimental development builds. - Team-Based Groups: Assign a dedicated group to a specific department (e.g.,
Data-Science-Runners,Mobile-Team-Runners). This allows teams to manage their own budget and capacity independently. - Security-Tiered Groups: Create a
Hardenedgroup for code that touches production secrets or PCI-compliant data, and aGeneralgroup for internal tooling. TheHardenedgroup can be configured with stricter network egress filtering.
Assessing Capacity Requirements
When planning your groups, you must calculate the "concurrency" needs of each group. If your Production group has 50 runners but you have 100 concurrent deployments, you will face queueing delays. Use the following formula as a starting point:
Max Concurrency = (Total Average Daily Jobs) / (Average Time Per Job in Minutes).
Not read yet
Configuring Runner Groups: Step-by-Step
Configuring runner groups is performed through the GitHub Enterprise settings or via the GitHub API. For enterprise-wide management, the API is the only scalable way to maintain consistency.
Manual Configuration (Small Scale)
- Navigate to your Enterprise account or Organization settings in GitHub.
- In the sidebar, select Actions > Runner groups.
- Click New runner group.
- Provide a clear name (e.g.,
prod-high-performance-compute). - Set the Access policy: Choose between "All repositories," "Selected repositories," or "Private repositories."
- Configure the Runner restrictions: You can choose to allow only repositories that meet certain criteria, or explicitly list the authorized repositories.
- Click Create group.
Programmatic Configuration (Enterprise Scale)
Using the GitHub API allows you to automate the creation of groups as part of your infrastructure-as-code (IaC) pipeline. Below is an example using curl to create a runner group via the REST API.
# Define your variables
GITHUB_TOKEN="your_personal_access_token"
ORG_NAME="your-organization"
GROUP_NAME="security-hardened-runners"
# Execute the API call
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/$ORG_NAME/actions/runner-groups \
-d '{
"name": "'"$GROUP_NAME"'",
"visibility": "selected",
"selected_repository_ids": [12345678, 87654321],
"allows_public_repositories": false,
"restricted_to_workflows": false
}'
Note: When using the API, ensure your GitHub App or Personal Access Token has the
admin:orgormanage_runners:enterprisescope. Without these permissions, the API will return a 403 Forbidden error.
Not read yet
Advanced Management: Policies and Security
Managing runners at scale is not just about connectivity; it is about security. Every runner is a potential entry point into your infrastructure. If a runner is compromised, the attacker could potentially access the secrets stored in your repository or the network environment where the runner resides.
Implementing Network Security
One of the most effective ways to secure runner groups is by restricting network access. If you are running your own infrastructure (e.g., on AWS or Azure), place your runners in private subnets with no public internet access. Use a proxy or a NAT gateway to allow access only to the GitHub API endpoints.
Ephemeral Runners and Automatic Cleanup
For security-sensitive groups, you should always use ephemeral runners. An ephemeral runner is a runner that automatically unregisters itself from GitHub after executing a single job. This ensures that if a build process leaves behind malicious artifacts or persistent shells, they are destroyed along with the runner instance.
To configure an ephemeral runner, start the runner software with the --ephemeral flag:
# Example of starting an ephemeral runner
./config.sh --url https://github.com/org/repo --token <TOKEN> --runnergroup security-hardened-runners --ephemeral
./run.sh
Enforcing Policies via Organization Settings
You can set policies at the enterprise level that apply to all runner groups. For example, you can mandate that all runners must be updated within a certain timeframe or that only specific versions of the runner software are permitted. This is essential for maintaining compliance with internal security audits.
Not read yet
Troubleshooting Common Issues
Even with a well-architected system, things will go wrong. Here are the most common pitfalls and how to navigate them.
1. The "Runner Group Not Found" Error
This usually occurs when a workflow file references a runs-on label that does not exist within the permitted runner groups for that repository.
- The Fix: Check the workflow's
runs-onconfiguration and verify that the repository is explicitly included in the runner group's access list. If you are using "Selected repositories," you must add the repository ID to the group configuration.
2. Unexpected Queueing
If your jobs are sitting in the queue despite having runners available, it is often a group-level concurrency limit or a labeling mismatch.
- The Fix: Check the "Runner Groups" settings page to see if you have reached the maximum concurrent job limit for that group. Also, ensure the runner labels used in the job match the labels applied to the runners within that specific group.
3. Permission Conflicts
If you have multiple groups with overlapping repository access, GitHub will default to the most restrictive settings or prioritize the group that was created first.
- The Fix: Maintain a strictly hierarchical structure. Avoid overlapping repository access. If a repository needs access to two different types of runners, create a single group that contains both types of runners, rather than trying to assign the repository to two different groups.
Callout: The "Default" Group Trap Many organizations make the mistake of leaving all their runners in the "Default" group. This group has global visibility, meaning any repository in your organization can potentially use these runners. This is a significant security risk. Always move production runners out of the "Default" group and into specific, restricted groups.
Not read yet
Scaling Operations with Infrastructure as Code (IaC)
When managing hundreds of runners, you cannot rely on manual clicks in the GitHub UI. You should treat your runner infrastructure as code. Tools like Terraform are perfect for this.
Example: Managing Runner Groups with Terraform
Using the github provider for Terraform, you can define your runner groups as resources. This ensures that your configuration is version-controlled and auditable.
resource "github_organization_runner_group" "prod_group" {
name = "production-runners"
visibility = "selected"
selected_repository_ids = [data.github_repository.prod_app.id]
allows_public_repositories = false
}
resource "github_actions_runner_group_runner" "add_runner" {
runner_group_id = github_organization_runner_group.prod_group.id
runner_id = github_actions_runner.my_runner.id
}
By using IaC, you gain several advantages:
- Repeatability: You can spin up a new environment (e.g., a new region or a new team's infrastructure) in minutes.
- Auditability: Every change to your runner group configuration is tracked in a git commit history, showing exactly who changed the policy and why.
- Consistency: You eliminate "configuration drift," where runners in different groups accidentally end up with different security settings.
Not read yet
Best Practices for Enterprise Runner Management
To ensure your runner infrastructure remains performant and secure, follow these industry-standard best practices:
- Implement "Just-in-Time" Runner Scaling: Do not keep your runners running 24/7 if you don't have jobs. Use tools like
actions-runner-controller(ARC) on Kubernetes to scale your runners up and down based on the number of pending jobs in your queues. - Monitor System Health: Use tools like Prometheus and Grafana to track metrics such as runner CPU usage, memory pressure, and job success rates. If a group of runners consistently hits high memory usage, it is a sign that your runner sizing needs to be adjusted.
- Regular Security Audits: Review your runner group access policies quarterly. Remove repositories that are no longer active and rotate the registration tokens used by your self-hosted runners.
- Standardize Naming Conventions: Use a predictable naming scheme for your groups (e.g.,
env-team-purpose-region). This makes it significantly easier to manage permissions and troubleshoot issues via the API. - Isolate Network Traffic: If your runners need to access internal databases or APIs, ensure they are in a dedicated VPC or subnet. Do not allow your runners to have unrestricted access to your entire corporate network.
Not read yet
Comparison Table: Shared vs. Grouped Runners
| Feature | Shared (Default) Runners | Custom Runner Groups |
|---|---|---|
| Access Control | Open to all repos in org | Restricted to specific repos |
| Security | Low (Shared environment) | High (Isolated environment) |
| Capacity Mgmt | None | Granular (per group) |
| Configuration | Static | Dynamic (via API/IaC) |
| Best For | Proof-of-concepts, small teams | Production, compliance-heavy workloads |
Common Questions and FAQ
Q: Can a runner belong to multiple groups? A: No. A single runner instance can only be a member of one runner group at a time. If you need a runner to be available for multiple purposes, it is better to assign multiple labels to that runner rather than trying to put it in multiple groups.
Q: What happens if I delete a runner group? A: If you delete a runner group that contains runners, those runners will automatically be moved to the "Default" group. This can cause security issues if you had specific restrictions on those runners, so always ensure you have a plan for the affected runners before deleting a group.
Q: How do I handle runners that need access to secrets? A: Runners themselves do not "have" secrets; they execute workflows that have access to secrets. However, you should use runner groups to ensure that only trusted repositories can access the runners that are configured to interact with your production environments.
Q: Does GitHub charge for runner groups? A: Runner groups are a feature of GitHub Enterprise. There is no additional cost for the groups themselves, but you are responsible for the compute costs of the infrastructure hosting your self-hosted runners.
Not read yet
Key Takeaways for Enterprise Success
Managing GitHub runner groups at scale is a foundational skill for any platform engineer or DevOps lead. By moving away from the default, open-access model to a structured, group-based architecture, you provide your organization with the security and reliability it needs to ship software at speed. Remember these critical points:
- Isolation is Security: Never leave production runners in the default group. Use runner groups to enforce a strict boundary between development, staging, and production environments.
- Automate Everything: Manual management is the enemy of scale. Use the GitHub API and Infrastructure as Code (Terraform) to define and manage your runner groups consistently.
- Use Ephemeral Runners: For high-security environments, always use the
--ephemeralflag. This minimizes the attack surface by ensuring that the runner environment is destroyed immediately after the job finishes. - Monitor Your Queues: Runner groups are only effective if they have the capacity to handle the workload. Monitor your queue times and job concurrency to ensure your groups are sized correctly.
- Standardize and Document: Establish a clear naming convention for your groups and document your access policies. This reduces friction for developers and makes troubleshooting significantly faster.
- Review Access Regularly: Access requirements change as projects evolve. Conduct periodic reviews of which repositories have access to which runner groups to prevent "permission creep."
- Labels are for Capability: Remember the distinction: use groups for security and access, and use labels for hardware capabilities and software environment requirements.
By mastering these concepts, you transform your CI/CD platform from a potential bottleneck into a powerful, scalable asset that enables your engineering teams to focus on building features rather than wrestling with infrastructure. As you continue to grow, keep iterating on your runner group strategy, and don't be afraid to break down large groups into smaller, more specialized ones as your needs evolve. The goal is to provide a "self-service" experience for your developers while maintaining the "enterprise-grade" control that your security team requires.
Not read yet
Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.
- Scheduled Event Triggers
- Scheduled Event Triggers Quiz5q
- Manual Workflow Dispatch
- Manual Workflow Dispatch Quiz5q
- Webhook Event Triggers
- Webhook Event Triggers Quiz5q
- Repository Events Configuration
- Repository Events Configuration Quiz5q
- Workflow Dispatch Inputs
- Workflow Dispatch Inputs Quiz5q
- Reusable Workflows with workflow_call
- Reusable Workflows with workflow_call Quiz5q
- Jobs and Steps Fundamentals
- Jobs and Steps Fundamentals Quiz5q
- Conditional Logic in Workflows
- Conditional Logic in Workflows Quiz5q
- Job Dependencies with needs
- Job Dependencies with needs Quiz5q
- Service Containers Configuration
- Service Containers Configuration Quiz5q
- Matrix Strategy Configuration
- Matrix Strategy Configuration Quiz5q
- YAML Anchors and Aliases
- YAML Anchors and Aliases Quiz5q
- Predefined Contexts Usage
- Predefined Contexts Usage Quiz5q
- Azure Integration Patterns
- Azure Integration Patterns Quiz5q
- AWS Integration Patterns
- AWS Integration Patterns Quiz5q
- Kubernetes Deployments
- Kubernetes Deployments Quiz5q
- Notification Integrations
- Notification Integrations Quiz5q
- Code Quality Integrations
- Code Quality Integrations Quiz5q
- Third-Party Service Integration
- Third-Party Service Integration Quiz5q
- Workflow Orchestration Patterns
- Workflow Orchestration Patterns Quiz5q
- Multi-Environment Workflows
- Multi-Environment Workflows Quiz5q
- Blue-Green and Canary Deployments
- Blue-Green and Canary Deployments Quiz5q
- GitHub-Hosted Runners Configuration
- GitHub-Hosted Runners Configuration Quiz5q
- Self-Hosted Runners Setup
- Self-Hosted Runners Setup Quiz5q
- Runner Groups Management
- Runner Groups Management Quiz5q
- IP Allow Lists and Networking
- IP Allow Lists and Networking Quiz5q
- Runner Troubleshooting
- Runner Troubleshooting Quiz5q
- Environment Protections
- Environment Protections Quiz5q
- Trustworthy Marketplace Actions
- Trustworthy Marketplace Actions Quiz5q
- Script Injection Mitigation
- Script Injection Mitigation Quiz5q
- GITHUB_TOKEN Permissions
- GITHUB_TOKEN Permissions Quiz5q
- OIDC Token for Cloud Federation
- OIDC Token for Cloud Federation Quiz5q
- Action Version Pinning
- Action Version Pinning Quiz5q
- Artifact Attestations and Provenance
- Artifact Attestations and Provenance Quiz5q
Spend your points to unlock exam-style practice questions
Spend points to unlock GH-200 exam-style practice questions.
Practice for GH-200