Giter Club home page Giter Club logo

cdk-github-actions-runner's Introduction

GitHub Actions runner on AWS Fargate

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

Construct

The solution presented in this repository is available as a Construct library in NPM and GitHub.

You can import it to your project by:

import { GithubActionsRunner } from "@cloudgardener/cdk-aws-fargate-github-actions-runner";

Docker image

Docker image is based on ubuntu:20.04 / focal. I may consider moving back to ubuntu:rolling once actions/runner#1584 is resolved.

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.