Skip to content

canonical/github-runner-webhook-router

Repository files navigation

GitHub Runner Webhook Router

CharmHub Badge Promote charm Discourse Status

This charm provides a webhook router for self-hosted GitHub Actions runners. It is designed to be used in conjunction with the GitHub Runner charm.

The charm was built using the paas-charm approach and runs on Kubernetes.

The router is a Flask application that listens for incoming webhooks from GitHub and routes them to the appropriate GitHub Runner charm application, which then spawns a runner to execute the job. It is a critical component for the "reactive" mode of the GitHub Runner Charm.

Like any Juju charm, this charm supports one-line deployment, configuration, integration, scaling, and more. For the GitHub Runner Webhook Router, this includes

  • All the general and Flask-related features of paas-charm
  • Configuring the routing table
  • Configuring a webhook secret to improve the security of the webhook endpoint

For information on how to deploy, integrate and manage this charm, please see the official GitHub Runner Webhook Router Documentation.

Get started

As the charm is designed to be used in conjunction with the GitHub Runner charm, please see How to set up reactive spawning to learn how to deploy the charm.

Basic operations

Configure a routing table to decide which labels should be routed to which GitHub Runner charm application:

cat <<EOF > routing_table.yaml
- large: [large, x64]
- large-arm: [large, arm64]
- small: [small]
EOF
juju config github-runner-webhook-router routing-table="$(cat routing_table.yaml)"

Change the default flavor to be used for jobs only containing default self-hosted-labels:

juju config github-runner-webhook-router default-flavour=small

Change the webhook secret used for webhook validation:

juju config github-runner-webhook-router webhook-secret=<your-secret>

In an error scenario, you may want to redeliver failed webhook deliveries. You can use the redeliver-failed-webhooks action to redeliver failed webhook deliveries. The following example redelivers failed deliveries since last minute for a webhook with ID 516986490

juju add-secret github-token token=<your-token> # the token needs webhook write permissions
# output is: secret:ctik2gfmp25c7648t7j0
juju run-action github-runner-webhook-router/0 redeliver-failed-webhook github-path=canonical/github-runner-webhook-router webhook-id=516986490 since=60 github-token-secret-id=ctik2gfmp25c7648t7j0

Integrations

The charm requires an integration with MongoDB (either the machine or k8s charm), otherwise it will go into a blocked state. For a complete list of integrations, see the Charmhub documentation.

Learn more

Project and community