|
1 | 1 | --- |
2 | | -title: "CI/CD mit n8n + sin-github-action" |
| 2 | +title: Ultimate CI/CD via n8n & sin-github-action |
| 3 | +description: Mandatory zero-billing delivery doctrine using OCI, n8n, and controlled automation instead of standard GitHub-hosted runners. |
3 | 4 | --- |
4 | 5 |
|
5 | | -# CI/CD mit n8n + sin-github-action |
| 6 | +# Ultimate CI/CD via n8n & sin-github-action |
6 | 7 |
|
7 | | -> **🚨 ABSOLUTES VERBOT: Normale GitHub Actions Runner von GitHub DÜRFEN NIEMALS genutzt werden!** |
8 | | -> |
9 | | -> GitHub Actions Billing ist ein bekanntes Blocking-Problem in der OpenSIN-AI Organisation. Jede CI/CD-Pipeline MUSS über **n8n auf der OCI VM** + **sin-github-action** laufen. |
| 8 | +> **RULE:** Standard GitHub-hosted Actions runners are banned for core OpenSIN delivery paths when the OCI+n8n zero-billing route exists. |
10 | 9 |
|
11 | 10 | --- |
12 | 11 |
|
13 | | -## Warum kein normales GitHub Actions? |
| 12 | +## 1. Why This Exists |
14 | 13 |
|
15 | | -| Problem | Details | |
16 | | -|---------|---------| |
17 | | -| 💸 **Billing blockiert** | GitHub Actions Billing schlägt fehl → Jobs starten nicht | |
18 | | -| 🐢 **Zu langsam** | Paid Runner: 10+ Minuten Startup + Build | |
19 | | -| 🔒 **Vendor Lock-in** | Abhängigkeit von GitHub Infrastruktur | |
20 | | -| 💰 **Kosten** | Bezahlte Runner = direkte Kosten pro Minute | |
| 14 | +The fleet must keep delivery: |
| 15 | +- cheap |
| 16 | +- observable |
| 17 | +- reproducible |
| 18 | +- controllable |
| 19 | +- integrated with our issue/dispatch model |
21 | 20 |
|
22 | | -**Unsere Lösung:** GitHub Runner läuft nur ~2 Sekunden (curl-only), der eigentliche Build läuft auf unserem **kostenlosen OCI VM (Oracle Cloud Always-Free)**. Zero Billing. |
| 21 | +n8n on OCI gives us exactly that. |
23 | 22 |
|
24 | 23 | --- |
25 | 24 |
|
26 | | -## Architektur |
| 25 | +## 2. Canonical Delivery Path |
27 | 26 |
|
28 | | -``` |
29 | | -GitHub Push/PR |
30 | | - │ |
31 | | - ▼ |
32 | | -sin-github-action (composite, nur curl — ~2s, fast kostenlos) |
33 | | - │ POST /webhook/opensin-ci |
34 | | - ▼ |
35 | | -n8n @ http://92.5.60.87:5678 (n8n.delqhi.com) |
36 | | - │ HTTP Request Node → 172.18.0.1:3456/run |
37 | | - ▼ |
38 | | -opensin-ci-runner.py (systemd service auf OCI VM) |
39 | | - │ git clone → npm ci → npm run build → npm test |
40 | | - ▼ |
41 | | -GitHub Commit Status API ✅ / ❌ |
42 | | -``` |
| 27 | +GitHub event → n8n workflow on OCI → controlled runner / scripts → artifacts / deploy / notifications |
43 | 28 |
|
44 | | -### Komponenten |
45 | | - |
46 | | -| Komponente | Ort | Zweck | |
47 | | -|-----------|-----|-------| |
48 | | -| `sin-github-action` | [github.com/OpenSIN-AI/sin-github-action](https://github.com/OpenSIN-AI/sin-github-action) | Composite GitHub Action (nur curl, ~2s) | |
49 | | -| n8n Workflow `cx2UwQYwBPKucckV` | OCI VM 92.5.60.87:5678 | Webhook → CI Runner Dispatcher | |
50 | | -| `opensin-ci-runner.py` | `/home/ubuntu/opensin-ci-runner.py` (OCI) | Python HTTP Server, führt Build/Test aus | |
51 | | -| systemd service | `opensin-ci-runner.service` (OCI) | Hält den CI Runner am Leben | |
| 29 | +### Why |
| 30 | +This keeps delivery inside our own automation backbone instead of outsourcing critical orchestration to an opaque hosted runner model. |
52 | 31 |
|
53 | 32 | --- |
54 | 33 |
|
55 | | -## Setup für ein neues Repo |
56 | | - |
57 | | -### 1. Secret setzen |
58 | | - |
59 | | -```bash |
60 | | -gh secret set N8N_CI_WEBHOOK_URL \ |
61 | | - --repo OpenSIN-AI/<DEIN-REPO> \ |
62 | | - --body "http://92.5.60.87:5678/webhook/opensin-ci" |
63 | | -``` |
64 | | - |
65 | | -### 2. `.github/workflows/ci.yml` anlegen |
66 | | - |
67 | | -```yaml |
68 | | -name: CI → n8n OCI Runner |
69 | | - |
70 | | -# ╔══════════════════════════════════════════════════════════════════╗ |
71 | | -# ║ ZERO BILLING CI — delegates all work to n8n on OCI VM ║ |
72 | | -# ║ Runner cost: ~2s (curl only) instead of 10+ min paid runners ║ |
73 | | -# ║ Build/test/lint runs on: OCI VM via n8n @ n8n.delqhi.com ║ |
74 | | -# ╚══════════════════════════════════════════════════════════════════╝ |
| 34 | +## 3. What Belongs in CI/CD |
75 | 35 |
|
76 | | -on: |
77 | | - push: |
78 | | - branches: [main] |
79 | | - pull_request: |
80 | | - branches: [main] |
81 | | - |
82 | | -jobs: |
83 | | - dispatch: |
84 | | - runs-on: ubuntu-latest |
85 | | - timeout-minutes: 2 |
86 | | - steps: |
87 | | - - name: Dispatch CI to n8n OCI Runner |
88 | | - uses: OpenSIN-AI/sin-github-action@main |
89 | | - with: |
90 | | - n8n_webhook_url: ${{ secrets.N8N_CI_WEBHOOK_URL }} |
91 | | - github_token: ${{ secrets.GITHUB_TOKEN }} |
92 | | - pipeline: all |
93 | | -``` |
94 | | -
|
95 | | -### 3. Fertig |
96 | | -
|
97 | | -Der Push triggert automatisch: |
98 | | -1. GitHub Action startet (ubuntu-latest, ~2s) |
99 | | -2. `sin-github-action` setzt Commit-Status auf `pending` |
100 | | -3. POST an n8n Webhook `http://92.5.60.87:5678/webhook/opensin-ci` |
101 | | -4. n8n leitet weiter an CI Runner (Port 3456 auf OCI Host) |
102 | | -5. CI Runner klont Repo, führt `npm run build` + `npm test` aus |
103 | | -6. GitHub Commit-Status wird auf `success` ✅ oder `failure` ❌ gesetzt |
| 36 | +- lint/build/test gates |
| 37 | +- deployment packaging |
| 38 | +- branch / PR checks |
| 39 | +- release notes / notifications |
| 40 | +- environment validation |
104 | 41 |
|
105 | 42 | --- |
106 | 43 |
|
107 | | -## Verfügbare Pipeline-Modi |
| 44 | +## 4. What Must Be Avoided |
108 | 45 |
|
109 | | -Der `pipeline` Input in der Action steuert, was gebaut wird: |
110 | | - |
111 | | -| Wert | Was läuft | |
112 | | -|------|-----------| |
113 | | -| `all` | build + test (Standard) | |
114 | | -| `build` | Nur `npm run build` | |
115 | | -| `test` | Nur `npm test` | |
116 | | -| `lint` | Nur `npm run lint` | |
| 46 | +- hidden runner behavior |
| 47 | +- expensive unnecessary jobs |
| 48 | +- duplicate workflows in GitHub and n8n doing the same thing |
| 49 | +- deployment scripts that cannot be rerun safely |
117 | 50 |
|
118 | 51 | --- |
119 | 52 |
|
120 | | -## n8n Workflow Details |
121 | | - |
122 | | -### Workflow: `OpenSIN CI Webhook` |
123 | | -- **ID:** `cx2UwQYwBPKucckV` |
124 | | -- **Webhook Path:** `opensin-ci` |
125 | | -- **Webhook URL:** `http://92.5.60.87:5678/webhook/opensin-ci` |
126 | | -- **Öffentliche URL:** `https://n8n.delqhi.com/webhook/opensin-ci` |
127 | | - |
128 | | -### n8n API Key (für Verwaltung) |
129 | | - |
130 | | -```bash |
131 | | -N8N_KEY="n8n_api_69175bcabef4b10d619b43598cd557a92ee38aac5ae4b1ca" |
132 | | -N8N_URL="http://92.5.60.87:5678" |
133 | | -
|
134 | | -# Workflow Status prüfen |
135 | | -curl -H "X-N8N-API-KEY: $N8N_KEY" "$N8N_URL/api/v1/workflows/cx2UwQYwBPKucckV" | python3 -c "import json,sys; d=json.load(sys.stdin); print('active:', d.get('active'))" |
136 | | -
|
137 | | -# Workflow aktivieren (nach Neustart nötig) |
138 | | -curl -X POST -H "X-N8N-API-KEY: $N8N_KEY" "$N8N_URL/api/v1/workflows/cx2UwQYwBPKucckV/activate" |
139 | | -``` |
140 | | - |
141 | | -### ⚠️ Wichtig: n8n Webhook Registrierung |
142 | | - |
143 | | -In n8n 2.12 (SQLite) werden Webhooks **nur beim Startup** aus der DB geladen. Wenn der Workflow nach dem Start über die API aktiviert wird, muss der Container neugestartet werden: |
144 | | - |
145 | | -```bash |
146 | | -ssh ubuntu@92.5.60.87 "docker restart n8n-n8n-1 && sleep 15" |
147 | | -``` |
148 | | - |
149 | | -Nach dem Neustart prüfen: |
150 | | -```bash |
151 | | -ssh ubuntu@92.5.60.87 "docker logs n8n-n8n-1 2>&1 | grep 'OpenSIN CI'" |
152 | | -# Erwartete Ausgabe: Activated workflow "OpenSIN CI Webhook" (ID: cx2UwQYwBPKucckV) |
153 | | -``` |
154 | | - |
155 | | ---- |
156 | | - |
157 | | -## CI Runner Details |
158 | | - |
159 | | -Der CI Runner ist ein Python HTTP Server auf dem OCI VM. |
| 53 | +## 5. Required Properties |
160 | 54 |
|
161 | | -### Service verwalten |
162 | | - |
163 | | -```bash |
164 | | -# Status |
165 | | -ssh ubuntu@92.5.60.87 "sudo systemctl status opensin-ci-runner" |
166 | | -
|
167 | | -# Logs |
168 | | -ssh ubuntu@92.5.60.87 "sudo journalctl -u opensin-ci-runner -f" |
169 | | -
|
170 | | -# Neustart |
171 | | -ssh ubuntu@92.5.60.87 "sudo systemctl restart opensin-ci-runner" |
172 | | -``` |
173 | | - |
174 | | -### Manueller Test |
175 | | - |
176 | | -```bash |
177 | | -ssh ubuntu@92.5.60.87 'curl -s -X POST \ |
178 | | - -H "Content-Type: application/json" \ |
179 | | - http://127.0.0.1:3456/run \ |
180 | | - -d "{\"secret\":\"opensin-ci-2026\",\"repo\":\"OpenSIN-AI/OpenSIN-Code\",\"sha\":\"abc\",\"ref\":\"main\",\"pipeline\":\"all\",\"github_token\":\"DEIN_TOKEN\"}"' |
181 | | -``` |
182 | | - |
183 | | -### Service-Datei |
184 | | - |
185 | | -``` |
186 | | -/etc/systemd/system/opensin-ci-runner.service |
187 | | -/home/ubuntu/opensin-ci-runner.py |
188 | | -``` |
189 | | -
|
190 | | -### Netzwerk-Konfiguration |
191 | | -
|
192 | | -Der CI Runner bindet auf `0.0.0.0:3456`. Der n8n Docker Container (Netzwerk `n8n_default`, Bridge `172.18.0.0/16`) erreicht den Host über `172.18.0.1:3456`. |
193 | | -
|
194 | | -**iptables Regel (persistent):** |
195 | | -```bash |
196 | | -sudo iptables -I INPUT 1 -s 172.18.0.0/16 -p tcp --dport 3456 -j ACCEPT |
197 | | -sudo iptables -I DOCKER-USER -s 172.18.0.0/16 -p tcp --dport 3456 -j ACCEPT |
198 | | -# Gespeichert in /etc/iptables/rules.v4 |
199 | | -``` |
| 55 | +Every CI/CD flow should be: |
| 56 | +- idempotent where possible |
| 57 | +- visible in logs |
| 58 | +- linked to issue/PR state |
| 59 | +- fail-closed on missing secrets or invalid config |
| 60 | +- able to notify operators on failure |
200 | 61 |
|
201 | 62 | --- |
202 | 63 |
|
203 | | -## Troubleshooting |
204 | | - |
205 | | -### Problem: GitHub Action schlägt fehl mit Billing-Fehler |
206 | | - |
207 | | -``` |
208 | | -The job was not started because recent account payments have failed |
209 | | -``` |
| 64 | +## 6. Final Rule |
210 | 65 |
|
211 | | -**Fix:** Das ist normal für direkte GitHub-hosted Runner. Der CI Dispatch Job braucht trotzdem einen Runner. Lösung: `runs-on: ubuntu-latest` mit `timeout-minutes: 2` — der Job startet, sendet den Webhook, und endet in <2s. |
212 | | - |
213 | | -Falls auch das blockiert → lokalen self-hosted Runner auf OCI registrieren: |
214 | | - |
215 | | -```bash |
216 | | -# Auf OCI VM: |
217 | | -mkdir -p ~/actions-runner && cd ~/actions-runner |
218 | | -curl -o actions-runner-linux-arm64-2.x.tar.gz -L https://github.com/actions/runner/releases/download/v2.x/actions-runner-linux-arm64-2.x.tar.gz |
219 | | -tar xzf ./actions-runner-linux-arm64-2.x.tar.gz |
220 | | -./config.sh --url https://github.com/OpenSIN-AI --token <RUNNER_TOKEN> |
221 | | -sudo ./svc.sh install && sudo ./svc.sh start |
222 | | -``` |
223 | | - |
224 | | -Dann in `ci.yml`: `runs-on: self-hosted` |
225 | | - |
226 | | -### Problem: Webhook 404 nach n8n Neustart |
227 | | - |
228 | | -Der Workflow ist nicht mehr active. Re-aktivieren und neu starten: |
229 | | - |
230 | | -```bash |
231 | | -N8N_KEY="n8n_api_69175bcabef4b10d619b43598cd557a92ee38aac5ae4b1ca" |
232 | | -curl -X POST -H "X-N8N-API-KEY: $N8N_KEY" \ |
233 | | - http://92.5.60.87:5678/api/v1/workflows/cx2UwQYwBPKucckV/activate |
234 | | -ssh ubuntu@92.5.60.87 "docker restart n8n-n8n-1" |
235 | | -sleep 15 |
236 | | -# Test: |
237 | | -curl -s -o/dev/null -w "HTTP:%{http_code}" -X POST \ |
238 | | - -H "Content-Type: application/json" \ |
239 | | - http://92.5.60.87:5678/webhook/opensin-ci \ |
240 | | - -d '{"repo":"test","sha":"abc","ref":"main","pipeline":"all","github_token":"x"}' |
241 | | -``` |
242 | | - |
243 | | -### Problem: CI Runner nicht erreichbar aus n8n Container |
244 | | - |
245 | | -```bash |
246 | | -# Netzwerk prüfen |
247 | | -ssh ubuntu@92.5.60.87 "docker exec n8n-n8n-1 ip route show" |
248 | | -# Docker host IP aus Container herausfinden (Gateway) |
249 | | -# Dann iptables regeln für diese IP prüfen: |
250 | | -ssh ubuntu@92.5.60.87 "sudo iptables -L INPUT -n | grep 3456" |
251 | | -``` |
252 | | - |
253 | | -### Problem: `docker-compose up` → Container Conflict |
254 | | - |
255 | | -```bash |
256 | | -ssh ubuntu@92.5.60.87 "docker rm -f n8n-n8n-1 && cd /opt/n8n && docker compose up -d" |
257 | | -``` |
| 66 | +**CI/CD is not “whatever makes the green checkmark appear.”** |
| 67 | +It is controlled, observable delivery with minimal cost and maximal evidence. |
258 | 68 |
|
259 | 69 | --- |
260 | 70 |
|
261 | | -## Verwandte Ressourcen |
262 | | - |
263 | | -- [sin-github-action Repo](https://github.com/OpenSIN-AI/sin-github-action) |
264 | | -- [n8n OCI Admin](http://92.5.60.87:5678) (VPN/SSH-Tunnel nötig) |
265 | | -- [n8n Public UI](https://n8n.delqhi.com) |
266 | | -- [OCI VM SSH](ssh://ubuntu@92.5.60.87) |
267 | | -- [A2A-SIN-CI-CD Agent](https://github.com/OpenSIN-AI/A2A-SIN-CI-CD) |
| 71 | +*Last updated:* 2026-04-10 |
| 72 | +*Status:* **ACTIVE & MANDATORY** |
| 73 | +*Maintainer:* sin-zeus |
0 commit comments