# cyclenerd/google-cloud-github-runner architecture

> Architecture diagram of the GitHub repository cyclenerd/google-cloud-github-runner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cyclenerd/google-cloud-github-runner
- Repository: https://github.com/cyclenerd/google-cloud-github-runner

## Overview

The product provisions ephemeral, regional Google Compute Engine runners for GitHub Actions and includes a web flow for configuring the GitHub App. The primary runtime path is a GitHub workflow-job webhook through signature verification and lifecycle handling to runner creation or deletion. Setup separately exchanges GitHub App configuration and stores credentials. Source excerpts support the application calls; README statements support the broader GCP deployment capabilities. Terraform internals were not sampled, so infrastructure relationships are limited to documented links.

Main entry points: [`app/routes/webhook.py`](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/routes/webhook.py) (Webhook endpoint), [`app/routes/setup.py`](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/routes/setup.py) (Setup routes), [`app/services/webhook_service.py`](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/services/webhook_service.py) (Webhook processing), [`app/clients/gcloud_client.py`](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/clients/gcloud_client.py) (Compute client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Flask application<br/>[__init__.py]"]
  node_webhook_route["Webhook endpoint<br/>[webhook.py]"]
  node_signature["Signature verification<br/>[security.py]"]
end

subgraph group_setup["GitHub App setup"]
  node_setup_routes["Setup routes<br/>[setup.py]"]
  node_github_setup["GitHub App setup<br/>[github_service.py]"]
  node_config["Configuration storage<br/>[config_service.py]"]
end

subgraph group_lifecycle["Runner lifecycle"]
  node_webhook_service["Webhook processing<br/>[webhook_service.py]"]
  node_github_client["GitHub API client<br/>[github_client.py]"]
  node_gcloud_client["Compute client<br/>[gcloud_client.py]"]
end

subgraph group_cloud["Google Cloud infrastructure"]
  node_secrets[("Secret Manager<br/>[secret-manager.tf]")]
  node_cloud_run["Cloud Run service<br/>[cloud-run.tf]"]
  node_templates["Runner templates<br/>[compute-vm.tf]"]
  node_compute["Compute Engine<br/>[compute-vm.tf]"]
  node_artifact_registry[("Artifact Registry")]
  node_network["VPC networking<br/>[net-vpc.tf]"]
end

node_maintainer(("Operator"))
node_github(("GitHub"))

node_maintainer -->|"configures app"| node_setup_routes
node_github -->|"sends events"| node_webhook_route
node_app -->|"registers route"| node_webhook_route
node_app -->|"registers routes"| node_setup_routes
node_webhook_route -->|"verifies signature"| node_signature
node_webhook_route -->|"dispatches jobs"| node_webhook_service
node_setup_routes -->|"generates and exchanges"| node_github_setup
node_setup_routes -->|"stores credentials"| node_config
node_config -->|"writes secrets"| node_secrets
node_github_setup -->|"exchanges app code"| node_github
node_webhook_service -->|"requests registration token"| node_github_client
node_webhook_service -->|"creates or deletes runner"| node_gcloud_client
node_github_client -->|"requests runner token"| node_github
node_gcloud_client -->|"manages instances"| node_compute
node_gcloud_client -->|"selects template"| node_templates
node_cloud_run -->|"hosts application"| node_webhook_route
node_cloud_run -.->|"uses stored credentials"| node_secrets
node_artifact_registry -.->|"supplies container image"| node_cloud_run
node_network -.->|"provides networking"| node_compute
node_github -->|"runs jobs on ephemeral VMs"| node_compute

click node_app "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/__init__.py"
click node_webhook_route "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/routes/webhook.py"
click node_signature "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/utils/security.py"
click node_setup_routes "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/routes/setup.py"
click node_github_setup "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/services/github_service.py"
click node_config "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/services/config_service.py"
click node_secrets "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/gcp/secret-manager.tf"
click node_webhook_service "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/services/webhook_service.py"
click node_github_client "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/clients/github_client.py"
click node_gcloud_client "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/clients/gcloud_client.py"
click node_cloud_run "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/gcp/cloud-run.tf"
click node_templates "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/gcp/compute-vm.tf"
click node_compute "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/gcp/compute-vm.tf"
click node_artifact_registry "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/gcp/artifact-registry.tf"
click node_network "https://github.com/cyclenerd/google-cloud-github-runner/blob/master/gcp/net-vpc.tf"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_webhook_route,node_signature toneBlue
class node_setup_routes,node_github_setup,node_config toneAmber
class node_webhook_service,node_github_client,node_gcloud_client toneMint
class node_secrets,node_cloud_run,node_templates,node_compute,node_artifact_registry,node_network toneRose
class node_maintainer,node_github toneIndigo
```

## Components

### Web application

- [Flask application](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/__init__.py): `app/__init__.py`
- [Webhook endpoint](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/routes/webhook.py): `app/routes/webhook.py`
- [Signature verification](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/utils/security.py): `app/utils/security.py`

### GitHub App setup

- [Setup routes](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/routes/setup.py): `app/routes/setup.py`
- [GitHub App setup](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/services/github_service.py): `app/services/github_service.py`
- [Configuration storage](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/services/config_service.py): `app/services/config_service.py`

### Runner lifecycle

- [Webhook processing](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/services/webhook_service.py): `app/services/webhook_service.py`
- [GitHub API client](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/clients/github_client.py): `app/clients/github_client.py`
- [Compute client](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/app/clients/gcloud_client.py): `app/clients/gcloud_client.py`

### Google Cloud infrastructure

- [Secret Manager](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/gcp/secret-manager.tf): `gcp/secret-manager.tf`
- [Cloud Run service](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/gcp/cloud-run.tf): `gcp/cloud-run.tf`
- [Runner templates](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/gcp/compute-vm.tf): `gcp/compute-vm.tf`
- [Compute Engine](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/gcp/compute-vm.tf): `gcp/compute-vm.tf`
- [Artifact Registry](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/gcp/artifact-registry.tf): `gcp/artifact-registry.tf`
- [VPC networking](https://github.com/cyclenerd/google-cloud-github-runner/blob/master/gcp/net-vpc.tf): `gcp/net-vpc.tf`

### Other components

- **Operator**
- **GitHub**

## Connections

- Operator → Setup routes: configures app (evidence: `README.md`)
- GitHub → Webhook endpoint: sends events (evidence: `README.md`)
- Flask application → Webhook endpoint: registers route (evidence: `app/__init__.py`)
- Flask application → Setup routes: registers routes (evidence: `app/__init__.py`)
- Webhook endpoint → Signature verification: verifies signature (evidence: `app/routes/webhook.py`)
- Webhook endpoint → Webhook processing: dispatches jobs (evidence: `app/routes/webhook.py`)
- Setup routes → GitHub App setup: generates and exchanges (evidence: `app/routes/setup.py`)
- Setup routes → Configuration storage: stores credentials (evidence: `app/routes/setup.py`)
- Configuration storage → Secret Manager: writes secrets (evidence: `app/services/config_service.py`)
- GitHub App setup → GitHub: exchanges app code (evidence: `app/services/github_service.py`)
- Webhook processing → GitHub API client: requests registration token (evidence: `app/services/webhook_service.py`)
- Webhook processing → Compute client: creates or deletes runner (evidence: `app/services/webhook_service.py`)
- GitHub API client → GitHub: requests runner token (evidence: `app/clients/github_client.py`)
- Compute client → Compute Engine: manages instances (evidence: `app/clients/gcloud_client.py`)
- Compute client → Runner templates: selects template (evidence: `app/clients/gcloud_client.py`)
- Cloud Run service → Webhook endpoint: hosts application (evidence: `README.md`)
- Cloud Run service → Secret Manager: uses stored credentials (evidence: `README.md`)
- Artifact Registry → Cloud Run service: supplies container image (evidence: `README.md`)
- VPC networking → Compute Engine: provides networking (evidence: `README.md`)
- GitHub → Compute Engine: runs jobs on ephemeral VMs (evidence: `README.md`)
