Repository navigation
Description
Feature
GHES provides today Runners at enterprise level.
Having some pool usable by organizations (if enabled by orga owner in settings) can be helpful (project teams don't have to manage runners and scalability by them-self).
If it can be supported (as complement off enable_organization_runners parameter), it would be nice 😁.
Investigations
Currently if enable_organization_runners is used, the scale-up send as configuration:
{
"environment": "github-runners-poc",
"runnerServiceConfig": "--url https://github.company.com/some-org --token AAA[...] --labels ubuntu --runnergroup Default",
"runnerOwner": "some-org",
"runnerType": "Org"
}When new Runner is added manually at Enterprise Level (https://github.company.com/enterprises/[enterprise-name]/settings/actions/runners), the configuration parameters are:
./config.sh --url https://github.company.com/enterprises/my-company-name --token BBB[...]
Even if userdata_template parameter is used with a full custom user-data.sh script where $CONFIG is not used and previous line ~hardcoded:
.... It doesn't work due to token validity during time, which provides after ~1 hour of usage:
--------------------------------------------------------------------------------
| ____ _ _ _ _ _ _ _ _ |
| / ___(_) |_| | | |_ _| |__ / \ ___| |_(_) ___ _ __ ___ |
| | | _| | __| |_| | | | | '_ \ / _ \ / __| __| |/ _ \| '_ \/ __| |
| | |_| | | |_| _ | |_| | |_) | / ___ \ (__| |_| | (_) | | | \__ \ |
| \____|_|\__|_| |_|\__,_|_.__/ /_/ \_\___|\__|_|\___/|_| |_|___/ |
| |
| Self-hosted runner registration |
| |
--------------------------------------------------------------------------------
# Authentication
Http response code: Unauthorized from 'POST https://github.company.com/api/v3/actions/runner-registration'
{"message":"Token expired.","documentation_url":"https://docs.github.com/enterprise/3.2/rest"}
Response status code does not indicate success: 401 (Unauthorized).
Problems to solve
1° Parameter name:
A new enable_enterprise_runners, with company-name as value (=> string type), can be added.
It provides a config like:
{
"environment": "github-runners-poc",
"runnerServiceConfig": "--https://github.company.com/enterprises/my-company-name --token AAA[...] --labels ubuntu --runnergroup Default",
"runnerOwner": "my-company-name",
"runnerType": "Enterprise"
}2° Retrieve token usable at enterprise level:
Retrieve a token usable for Runner at Enterprise Level (the one given when "New Runner" is clicked in Enterprise Settings) is perhaps not obvious, should be investigated.
Activity
skyzyx commentedon Oct 20, 2021
I spent about 12 hours working through this same deployment, and ran into the exact same issue yesterday, trying to parse the differences between the current documentation and the GHES 3.2 docs.
Also to note: GHES 3.2 doesn't support the
workflow_jobevent (had to fall back tocheck_run), nor the--ephemeralswitch (although that's supposed to be coming in v3.3).axel3rd commentedon Oct 21, 2021
I will try to have info/help of GitHub team (version requirements, way to retrieve token, ...)
npalm commentedon Oct 26, 2021
@jonico did you try to run the runners on enterprise level?
jonico commentedon Nov 1, 2021
@npalm: I have tested other controllers with enterprise level scope but not your particular one (I have left GitHub and no longer have access to an enterprise account).
npalm commentedon Nov 1, 2021
thx for the update
axel3rd commentedon Nov 2, 2021
@jonico : Off chance, do you remember which ones? (To deep dive the way how the token is created with
manage_runners:enterprisescope). Many thanks.axel3rd commentedon Nov 3, 2021
NB1: When this issue will be solved, official GitHub documentation (Autoscaling with self-hosted runners > Recommended autoscaling solutions) should be updated 😁.
NB2: actions-runner-controller/actions-runner-controller is probably a good sample 🤔
jonico commentedon Nov 4, 2021
This is the one where I tested the support.
npalm commentedon Nov 9, 2021
@axel3rd did you got it all working, should we keep the issue open?
axel3rd commentedon Nov 9, 2021
@npalm no, it does not work. Issue should be kept open IMO.
Hard to find time from my side for the moment to investigate the way to:
npalm commentedon Nov 9, 2021
Are you using a service user? The module is set up to use an GitHub App. So no need to generate user tokens with scopes.
axel3rd commentedon Nov 10, 2021
@npalm : I should have a try when time ; with service account or "personal" admin token ; to subscribe runner or generate a correct token for that.
Even if GitHub App is no more used for generating token at Enterprise level, the module mechanism to store tokens/credentials (SSM, ...) could be nice to adapt.
axel3rd commentedon Dec 7, 2021
After find time and a exchange with GitHub support...
Autoscaling with self-hosted runners is only supported on GHES v3.3, so it is preferable to wait this release. (I suppose it is due to
workflow_job:queuedevent support, better thancheck_runevent only available in GHES v3.2.)But both are supported by this scalability solution => can work 😁.
PoC which is working fine with GHES 3.2 :
admin:enterprisepermission (the only available in GHES v3.2, perhapsadmin:enterprise/manage_runners:enterprisewould be better when available in GHES ... v3.3?)user-data.sh, customize/hard-code the actions-runner./config.shcall with:Note: It is just for a test, a sustainable implementation should have new parameters (proposal):
enable_enterprise_runners: Enable enterprise runner (same way asenable_organization_runners)enterprise_admin_pat: Admin PAT for runner token registrationenterprise_id: Enterprise name, if cannot be retrieved automatically (to check)With that, the original runner configuration (
./config.sh --unattended --name "$instance_id" --work "_work" $${config}) can be reused, with config provided in SSM.axel3rd commentedon Jan 4, 2022
FI: With GHES v3.3 Global Webhook can be configured, on Workflow jobs events.
Due to enterprise_admin_pat requirement (to create a token for runner authentication), the "GitHub App" become probably useless "At Enterprise Level".
npalm commentedon Jan 4, 2022
So for running on enterprise level the only option is using PAT?
5 remaining items
axel3rd commentedon Jan 14, 2022
The global webhook documenation for enterprise-cloud and enterprise-server@3.3 are the ~same, so I guess yes to 👍 ; but I cannot verify by myself.
axel3rd commentedon Apr 29, 2022
NB: Since runner v2.282.0, the
--patparameter has been introduced, helping to manage configuration of ephemeral runners (actions/runner#660):This parameter can be used to authenticate runner at Enterprise level directly with an admin PAT during the configuration step:
Perhaps more simple than register a temporary admin token, but in this case the PAT is in clear in
user-data.shgithub-actions commentedon May 30, 2022
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs. Thank you for your contributions.
axel3rd commentedon May 30, 2022
This issue should stay opened IMO (PR will be provided once https://github.com/philips-labs/terraform-aws-github-runner/pull/1256 rebased).
github-actions commentedon Jun 30, 2022
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs. Thank you for your contributions.
mariusfilipowski commentedon Oct 31, 2023
Some very cool ideas for GHES. Looking if we can adapt this.
As I see all APIs for the lambdas should be available on the Enterprise level
With Global Webhooks we have the possibility to notify the lambdas, I've check the events, they are the same - only without the part with the installation id
And with an enterprise pat, we can get an temp registration token.
The only problem is, that this is a PAT ;-) and tied to a person
But I see no other option right now. Perhaps Fine grained PATs in GHES 3.10. But they are still PATs.
npalm commentedon Nov 2, 2023
Would be great to got more support for GHES from the community. We are not on GHES so even cannot test the module for this. Any help welcome, including testing. Feel free to DM me in slack.
ardole commentedon Oct 28, 2024
Can the following new gh feature can unblock the support of enterprise level runners ?
https://github.blog/changelog/2024-10-22-enterprises-can-create-github-apps-for-use-within-the-enterprise/
micr0zz commentedon May 29, 2025
Is anyone looking into this? It would be fantastic to have the capability to register runners at the enterprise level. This would allow for warm pools and eliminate the need for multiple pools per organization.
alexjurkiewicz commentedon May 28, 2026
#5096 was recently opened 👀