This project demonstrates an approach to orchestrate ephemeral GitHub Actions Runner with different hosting for
different workflow job. For example, using container hosting runner
for high volume code scanning or linting workflow,
and using virtual machine hosting runner
for workflow which difficult to run on container, like iOS Apps build.
Producter
An NodeJS Lambda function which storesworkflow_job
events inJobs Table
.Jobs Table
An DynamoDB Table which tracksworkflow_job
status.Publisher
An Golang Lambda function which queriesJobs Table
and sends runner orchestration message toJobs Topic
SNS.Publisher
responsible for theflow control
, we don't want overheating AWS resource.Orchestrator (SQS + Lambda)
An SQS subscribesJobs Topic
on one particular runner host and OS combination ( example: EC2 and ubuntu subscription filter policy), and triggers a lambda to perform orchestration, spin up or tear down runners.
- GitHub sends
workflow_job
events toProducer
. Producer
inserts job events intoJobs Table
with status ('queued' or 'completed').Jobs Table
DynamoDB stream invokesMessenger
lambda to publish a notification onPublisher Topic
.Publisher
queriesJobs Table
to get a limited number of jobs (FIFO).Publisher
publishes jobs toJobs Topic
.Publisher
also publishes a notification onPublisher Topic
until there is no job remains inJobs Table
.Orchestrator
SQS subscribesJobs Topic
on one particular runner host and OS combination (e.g. eks ubuntu or ec2 windows).Orchestrator
SQS triggers a lambda to perform orchestration operation, spin up or tear down.- Self-hosted runner will register in GitHub, and start polling queued
workflow_job
.
- An AWS IAM user account which has enough permission to deploy:
- VPC (Subnets, Route Tables, NAT Gateway...etc.)
- API Gateway
- DynamoDB
- Lambda
- SNS
- SQS
- EC2
- EKS
- ECR
- CloudWatch Events
- Set up a GitHub Apps in your GitHub Account which has enough permission to send
workflow_job
events, and save theapp id
,private key
,app secret
andgithub token
in.env
file.
- Run
docker compose run --rm deployer make ci-deploy
to deploy the solution. - Update the GitHub App URL with the API Gateway endpoint.
- Run
docker compose run --rm deployer make test
to test:- Producer
- Publisher
- Orchestrator
- Support Lambda hosting runner.
- Support Distributed Tracing.