machulav / ec2-github-runner

On-demand self-hosted AWS EC2 runner for GitHub Actions
MIT License
718 stars 320 forks source link

Support GitHub Enterprise Server #35

Open machulav opened 3 years ago

jonbrohauge commented 2 years ago

Unfortunately I'm not proficient in TypeScript, so I am not qualified to code a solution, but I have done a bit of analysis, and found some pointers.

AFAICT you can manipulate the url by setting options.baseUrl in octokit/core to point to the GHES URL.

Heavily inspired by probot, it should be possible to set an environment variable containing the GHES URL.

For inspiration, take a peak at their docs, search for GHE_HOST The environment variable is used in their code here.

Disclaimer I am in no way affiliated with probot.

maheshsmartcow commented 2 years ago

I am trying to build self hosted ec2 runner on GH Enterprise, though the EC2 instance created (ec2-github-runner) but got timed out on the first run itself. Is this due to the GitHub Actions does not support Enterprise server ? Please advise.

AWS EC2 instance i-00ed10e0d6006e9c4 is up and running
Waiting 30s for the AWS EC2 instance to be registered in GitHub as a new self-hosted runner
Checking every 10s if the GitHub self-hosted runner is registered
Checking...
Checking...
Error: GitHub self-hosted runner registration error
Checking...
Error: A timeout of 5 minutes is exceeded. Your AWS EC2 instance was not able to register itself in GitHub as a new self-hosted runner.
maheshsmartcow commented 2 years ago

Regarding Enterprise support, I am not sure how complex it is to implement because I don't have experience in building GitHub Actions. I could see we are giving provision to pass runnerHomeDir as input param which is where actions_runner configurations are placed. What if we give another option to enter user_data to run from the runnerHomeDir itself.

image

Here, I am talking only about support for Enterprise servers, so I created a custom AMI with user_data to configure GH Actions for my enterprise server including running ./config.sh with predefined labels and name. but I don't want to run ./run.sh or ./svc.sh inside the AMI, so If we can have provision to run these commands from this plugin. It will be easy to start the runner and terminate the instance at the end.