Add support for cross-repo runners
Problem
Describe the enhancement Having an agent _per_ repo is very tedious and frustrating. It would be nice to have agents that can work across repositories to prevent potentially having hundreds of agents to maintain (with rotating tokens) across hundreds of repos Code Snippet n/a Additional information n/a
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Implement Cross-Repository GitHub Actions Runners
The current architecture requires a dedicated GitHub Actions runner for each repository, leading to an overwhelming number of agents to manage. This setup complicates maintenance, token rotation, and resource allocation, especially in environments with numerous repositories.
Awaiting Verification
Be the first to verify this fix
- 1
Create a Centralized Runner Configuration
Develop a centralized configuration file that defines the parameters for a shared runner that can access multiple repositories. This file should include authentication tokens and repository access permissions.
yamlrunner_config.yml - 2
Modify Runner Registration Process
Update the runner registration process to allow the runner to register itself with multiple repositories using the centralized configuration. This can be done by using the GitHub API to authenticate and link the runner to the specified repositories.
bashcurl -X POST -H 'Authorization: token YOUR_GITHUB_TOKEN' https://api.github.com/orgs/YOUR_ORG/actions/runners/registration - 3
Implement Token Management for Shared Runners
Create a secure method for managing and rotating tokens used by the shared runner. This could involve using a secrets management tool to store and retrieve tokens dynamically.
bashecho 'YOUR_SECRET_TOKEN' | vault kv put secret/github-actions/token value=- - 4
Update CI/CD Pipeline Definitions
Revise the CI/CD pipeline definitions in each repository to specify the use of the shared runner. This involves updating the 'runs-on' field in the workflow YAML files to point to the centralized runner.
yamlruns-on: [self-hosted, my-shared-runner] - 5
Test and Validate Cross-Repo Functionality
Run a series of tests across multiple repositories to ensure that the shared runner can execute workflows correctly. Monitor logs for any authentication or permission errors.
bashgh workflow run my-workflow.yml --repo YOUR_ORG/REPO_NAME
Validation
To confirm the fix worked, execute workflows in multiple repositories using the shared runner and verify that they complete successfully without errors related to runner access or token authentication. Monitor the runner logs for any issues.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep