-
Notifications
You must be signed in to change notification settings - Fork 658
GHES Runners at Enterprise Level support #1303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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 |
I will try to have info/help of GitHub team (version requirements, way to retrieve token, ...) |
@jonico did you try to run the runners on enterprise level? |
@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). |
thx for the update |
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 🤔 |
This is the one where I tested the support. |
@axel3rd did you got it all working, should we keep the issue open? |
@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:
|
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. |
@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. |
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 But both are supported by this scalability solution => can work 😁. PoC which is working fine with GHES 3.2 :
echo "TMP - Get a runner registration token..."
ENTERPRISE=my-company
ADMIN_PAT=ghp_TheCorrectAdminPAT
TOKEN_REGISTRATION=$(curl -fs -X POST -u token:$ADMIN_PAT -H "Accept: application/vnd.github.v3+json" ${ghes_url}/api/v3/enterprises/$ENTERPRISE/actions/runners/registration-token | jq -r ".token")
echo "Configuring GitHub Action Runner..."
sudo -iu $USER_NAME bash -c "cd actions-runner && ./config.sh --unattended --name $INSTANCE_ID --labels ubuntu,ubuntu-latest,ubuntu-20.04 --runnergroup Default --url ${ghes_url}/enterprises/$ENTERPRISE --token $TOKEN_REGISTRATION" Note: It is just for a test, a sustainable implementation should have new parameters (proposal):
With that, the original runner configuration ( |
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". |
So for running on enterprise level the only option is using PAT? |
From my understanding, yes ; because Create a registration token for an enterprise requires an access token with the |
I see, and we created the module with the vision to avoid using physical user accounts. But in this case, there seems indeed no other option. The Lambdas inside the module runners are creating all an authenticaation via an app installation. For supporting enterpise level runners a change is requied in those lambdas. For scaling the module relies on triggers. A trigger can be sent via a webhook (org / repo) or via an app (via installation). I assume that you can configure on enterprise level a webhook as well? |
Yes, but Global Webhook supports only a Secret as security mechanism, not a private key.
Yes, but perhaps too in the webhook lambda depending the previous change... The lambda environment variables will have some "pseudo" duplicate 😢, even if we can "replace" in the Terraform configuration:
By~:
(the ~ Currently I didn't try to remove completely the GitHub App for my tries ... these suppositions are "under investiguation" ^^ 😁. |
Note: On GHES in the webhook Payload (Global or from GitHubApp), there is the enterprise id: {
"action": "queued",
"workflow_job": {...}
"repository": {...}
"organization": {...}
"enterprise": {
"id": 1,
"slug": "company",
"name": "COMPANY",
...
}, => Could perhaps be stored in SQS and reused if |
Would the enterprise id also be present for orgs that are part of an enterprise on GH SaaS? I presume so as I think you can create enterprise level runners on GH SaaS too. |
The global webhook documenation for enterprise-cloud and [email protected] are the ~same, so I guess yes to 👍 ; but I cannot verify by myself. |
NB: Since runner v2.282.0, the
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 |
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. |
This issue should stay opened IMO (PR will be provided once https://github.com/philips-labs/terraform-aws-github-runner/pull/1256 rebased). |
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. |
Some very cool ideas for GHES. Looking if we can adapt this. The only problem is, that this is a PAT ;-) and tied to a person |
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. |
Can the following new gh feature can unblock the support of enterprise level runners ? |
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:When new Runner is added manually at Enterprise Level (https://github.company.com/enterprises/[enterprise-name]/settings/actions/runners), the configuration parameters are:
Even if
userdata_template
parameter is used with a full customuser-data.sh
script where$CONFIG
is not used and previous line ~hardcoded:https://github.com/philips-labs/terraform-aws-github-runner/blob/e28ceab2467b4e068ba7efaa59c75b7f1f3b3111/modules/runners/templates/install-config-runner.sh#L20
https://github.com/philips-labs/terraform-aws-github-runner/blob/e28ceab2467b4e068ba7efaa59c75b7f1f3b3111/modules/runners/templates/install-config-runner.sh#L29
.... It doesn't work due to token validity during time, which provides after ~1 hour of usage:
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:
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.
The text was updated successfully, but these errors were encountered: