From 501953c6362683327765556432f0fa2c0a13b5b2 Mon Sep 17 00:00:00 2001 From: tinqs-limited Date: Tue, 26 May 2026 01:20:05 +0100 Subject: [PATCH] =?UTF-8?q?tinqs/ci=20=E2=80=94=20composite=20actions=20+?= =?UTF-8?q?=20Lambda=20dispatcher=20for=20Spot=20CI=20runners?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Actions: checkout, setup-go, setup-node, setup-aws Dispatcher: Lambda → EC2 Spot (ephemeral, self-terminating) Images: base, go, node, docker, deploy, godot Co-Authored-By: Claude Opus 4.6 (1M context) --- DEVOPS.md | 115 +++++ PLAN.md | 30 ++ README.md | 175 ++++++++ checkout/README.md | 33 ++ checkout/action.yml | 77 ++++ images/base/Dockerfile | 20 + images/build-all.sh | 50 +++ images/deploy/Dockerfile | 10 + images/docker/Dockerfile | 27 ++ images/go/Dockerfile | 15 + images/godot/Dockerfile | 27 ++ images/node/Dockerfile | 13 + orchestrator/dispatch/go.mod | 32 ++ orchestrator/dispatch/go.sum | 60 +++ orchestrator/dispatch/main.go | 787 ++++++++++++++++++++++++++++++++++ setup-aws/README.md | 28 ++ setup-aws/action.yml | 59 +++ setup-go/README.md | 25 ++ setup-go/action.yml | 44 ++ setup-node/README.md | 27 ++ setup-node/action.yml | 68 +++ 21 files changed, 1722 insertions(+) create mode 100644 DEVOPS.md create mode 100644 PLAN.md create mode 100644 README.md create mode 100644 checkout/README.md create mode 100644 checkout/action.yml create mode 100644 images/base/Dockerfile create mode 100644 images/build-all.sh create mode 100644 images/deploy/Dockerfile create mode 100644 images/docker/Dockerfile create mode 100644 images/go/Dockerfile create mode 100644 images/godot/Dockerfile create mode 100644 images/node/Dockerfile create mode 100644 orchestrator/dispatch/go.mod create mode 100644 orchestrator/dispatch/go.sum create mode 100644 orchestrator/dispatch/main.go create mode 100644 setup-aws/README.md create mode 100644 setup-aws/action.yml create mode 100644 setup-go/README.md create mode 100644 setup-go/action.yml create mode 100644 setup-node/README.md create mode 100644 setup-node/action.yml diff --git a/DEVOPS.md b/DEVOPS.md new file mode 100644 index 0000000..4c16ac2 --- /dev/null +++ b/DEVOPS.md @@ -0,0 +1,115 @@ +# DevOps Reference + +## AWS Resources (eu-west-1) + +| Resource | Name/ID | Purpose | +|----------|---------|---------| +| Lambda | `tinqs-ci-dispatch` | Webhook handler + Spot launcher | +| DynamoDB | `tinqs-ci-runs` | Run tracking (repo, run_id, instance_id, status) | +| AMI | `tinqs-ci-runner-v2` (ami-00a129385002e4de9) | Pre-baked runner (Go, Node, Docker, act_runner) | +| Security Group | sg-030bf74b43d3faac7 | Runner SG (outbound HTTPS) | +| Subnet | subnet-04b5aeec9bfc4ec2c | Default VPC subnet | +| Instance Profile | tinqs-ci-runner | IAM role (S3, ECR, ECS, SSM) | +| CloudWatch | /aws/lambda/tinqs-ci-dispatch | Dispatcher logs | +| ECS Cluster | tinqs-git | Platform (Gitea) — NOT for CI runners | +| EFS | tinqs-git-repos (fs-03f3fb4859ceb12a3) | Gitea repo storage — NOT for CI | + +## Deleted resources (26 May 2026) + +| Resource | Why deleted | +|----------|-------------| +| Lambda `tinqs-ci-exec` | Never successfully ran a build. Deploy jobs go through Spot now. | +| CloudWatch `/aws/lambda/tinqs-ci-exec` | Log group for deleted Lambda | +| CloudWatch `/ecs/tinqs-runner` | From Fargate era, no longer used | + +## Webhook flow + +``` +Gitea (tinqs.com) + └─ per-repo webhook on push + └─ POST https:///dispatch + └─ Lambda tinqs-ci-dispatch + ├─ Fetch .gitea/workflows/*.yml via Gitea API + ├─ Evaluate triggers (branch + path filters) + ├─ For each matched workflow: + │ ├─ Read runs-on label + │ └─ RunInstances (Spot, ephemeral) + └─ Track in DynamoDB +``` + +## Spot instance lifecycle + +``` +1. Lambda calls RunInstances (Spot, InstanceInitiatedShutdownBehavior=terminate) +2. User-data runs: + a. Configure git auth (url.insteadOf with GITEA_TOKEN) + b. act_runner register --ephemeral --labels