Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Deploy self-hosted GitHub Actions runner to AWS Fargate using AWS Cloud Development Kit (CDK)

License

Notifications You must be signed in to change notification settings

qoala-engineering/cdk-github-actions-runner

 
 

Repository files navigation

GitHub Actions runner on AWS Fargate

This repository contains an example how to run self-hosted GitHub Actions runners on AWS Fargate!

Docker image

Docker image is based on ubuntu:rolling, which is currently pointed to 20.04 / focal.

On top the base image I have installed GitHub Actions Runner based on About self-hosted runners in GitHub documentation.

Deployment

The application is deployed to AWS using AWS Cloud Development Kit (AWS CDK).

  • Store two parameters GITHUB_ACCESS_TOKEN and GITHUB_ACTIONS_RUNNER_CONTEXT in to SSM Parameter Store.
    • For repository level runner set GITHUB_ACTIONS_RUNNER_CONTEXT value to https://github.com/<owner>/<repository>
    • For organization level runner set GITHUB_ACTIONS_RUNNER_CONTEXT value to https://github.com/<organization>
  • Run cdk synth --profile <your-aws-cli-profile>
  • Run cdk deploy --profile <your-aws-cli-profile>
  • Wait a little while ...

Now you should be able find your self-hosted runner from repository setting in GitHub:

We can see also from the Fargate Task Logs that the runner is successfully registered:

Personal Access Token Scopes

Registering self-hosted runner to repository level requires admin access to the repository, and repo scope for the access token.

Registering self-hosted runner to Organization level requires admin access to the organization, and admin:org scope for the access token.

Price Comparision

You can read about the comparisions I made from Price Comparision document.

Useful commands

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template

About

Deploy self-hosted GitHub Actions runner to AWS Fargate using AWS Cloud Development Kit (CDK)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 49.4%
  • Shell 21.6%
  • Dockerfile 18.4%
  • JavaScript 10.6%