@cloud-cli/on 1.59.0 → 1.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/db-client-BvMkK1lx.js +8 -0
- package/dist/db-client.d.ts +10 -16
- package/dist/db-client.d.ts.map +1 -1
- package/dist/events-BoODn7MY.js +56 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/matrix-expander-BItKqWu2.js +3439 -0
- package/dist/oidc.d.ts +39 -0
- package/dist/oidc.d.ts.map +1 -0
- package/dist/on.js +76 -22512
- package/dist/queue-DhXXzxm3.js +200 -0
- package/dist/rolldown-runtime-B0aSnxlc.js +20 -0
- package/dist/scheduler-2d1UPcxM.js +96 -0
- package/dist/secrets-BR6K16WY.js +30 -0
- package/dist/secrets-DhkqmawU.js +2 -0
- package/dist/server-CpHe08Nv.js +13445 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/timestamped-log-Dtz_Euu0.js +36 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/worker-riimPLUr.js +895 -0
- package/dist/workflow-registry-D4IciIF7.js +61 -0
- package/dist/workflows-BF2K4GpM.js +2 -0
- package/dist/workflows-Dm_0dWb_.js +4472 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -174,18 +174,21 @@ npx @cloud-cli/on [command] [options]
|
|
|
174
174
|
| ---- | ------------ | --------------------- | ---------------------- | ------------------------------------------------ |
|
|
175
175
|
| `-h` | `--help` | — | - | Prints CLI help message and exits. |
|
|
176
176
|
| `-c` | `--config` | `./runner.config.mjs` | `RUNNER_CONFIG_FILE` | Path to JavaScript configuration file. |
|
|
177
|
-
| `-d` | `--database` | - | `
|
|
177
|
+
| `-d` | `--database` | - | `DATABASE_URL` | Node.js ES module URL exporting the database API. |
|
|
178
178
|
| `-p` | `--port` | `11235` | `PORT` | Port for the Ingress HTTP server. |
|
|
179
179
|
| `-k` | `--workers` | `5` | `RUNNER_WORKERS` | Maximum concurrent jobs on this node. |
|
|
180
180
|
| | | | `RUNNER_ADMIN_SECRET` | Admin token to refresh secrets via API |
|
|
181
181
|
| | | | `RUNNER_WORKER_SECRET` | Worker token for job events and secret retrieval |
|
|
182
|
+
| | | | `RUNNER_OIDC_PROVIDER_URL` | OIDC issuer URL, for example `https://auth.api.apphor.de` |
|
|
183
|
+
| | | | `RUNNER_OIDC_CLIENT_ID` | Registered OIDC client identifier |
|
|
184
|
+
| | | | `RUNNER_OIDC_CLIENT_SECRET` | Registered OIDC client secret |
|
|
182
185
|
| | | | `RUNNER_SERVER_URL` | Webhook server URL used by workers. |
|
|
183
186
|
| | | | `RUNNER_TAGS` | Comma-separated worker capability tags. |
|
|
184
187
|
| | | | `RUNNER_VAPID_PUBLIC_KEY` | Public key for background Web Push notifications. |
|
|
185
188
|
| | | | `RUNNER_VAPID_PRIVATE_KEY` | Private key for background Web Push notifications. |
|
|
186
189
|
| | | | `RUNNER_VAPID_SUBJECT` | VAPID contact, such as `mailto:admin@example.com`. |
|
|
187
190
|
|
|
188
|
-
Set `RUNNER_ADMIN_SECRET` only on the HTTP server for dashboard and management APIs. Set the same non-empty `RUNNER_WORKER_SECRET` on the server and every worker to publish job-status refresh events and retrieve job-scoped secrets. The dashboard workflow APIs accept either Bearer authentication or HTTP Basic authentication with username `admin` and the admin secret.
|
|
191
|
+
Set `RUNNER_ADMIN_SECRET` only on the HTTP server for dashboard and management APIs. Set the same non-empty `RUNNER_WORKER_SECRET` on the server and every worker to publish job-status refresh events and retrieve job-scoped secrets. When the three `RUNNER_OIDC_*` values are configured, `/auth/login` enables browser sign-in, the browser uses the same bearer-token API path as external consumers, authenticated users can read logs, and the API token settings page issues and revokes scoped tokens through the OIDC provider. Register `https://your-runner-host/auth/callback` as the OIDC redirect URI. The dashboard workflow APIs accept either Bearer authentication or HTTP Basic authentication with username `admin` and the admin secret.
|
|
189
192
|
|
|
190
193
|
### Secrets
|
|
191
194
|
|
|
@@ -312,12 +315,12 @@ The Ingress Gateway listens for incoming HTTP requests and serves the live web U
|
|
|
312
315
|
AST evaluation explicitly blocks access to dangerous JS properties (`constructor`, `__proto__`, `prototype`).
|
|
313
316
|
3. **Payload Size Guard:**
|
|
314
317
|
The Ingress server enforces a strict 5MB payload limit to prevent Out-Of-Memory (OOM) denial-of-service attacks.
|
|
315
|
-
4. **
|
|
316
|
-
Workflow validation, publishing, secret management
|
|
318
|
+
4. **Scoped API authentication:**
|
|
319
|
+
Workflow validation, publishing, and secret management require `RUNNER_ADMIN_SECRET` over HTTPS. OIDC sessions and provider-issued scoped tokens can read job logs when granted `logs:read`. Workers use the separate `RUNNER_WORKER_SECRET` only for lifecycle events and secrets of jobs they have claimed.
|
|
317
320
|
|
|
318
321
|
## systemd Deployment
|
|
319
322
|
|
|
320
|
-
Install the unit files from `systemd/` and create root-owned environment files in `/etc/on/`: `server.env` for `
|
|
323
|
+
Install the unit files from `systemd/` and create root-owned environment files in `/etc/on/`: `server.env` for `DATABASE_URL`, `RUNNER_SERVER_URL`, `RUNNER_ADMIN_SECRET`, `RUNNER_WORKER_SECRET`, and the three `RUNNER_OIDC_*` values; `scheduler.env` for `DATABASE_URL`; and `worker.env` for `DATABASE_URL`, `RUNNER_SERVER_URL`, `RUNNER_WORKER_SECRET`, `RUNNER_TAGS`, and `RUNNER_TMP`. Workers receive only `RUNNER_WORKER_SECRET`; the admin and OIDC secrets stay on the HTTP server. The supplied units run as root because the systemd execution driver creates transient system services. Use `systemctl edit` for per-machine overrides.
|
|
321
324
|
|
|
322
325
|
Place the server master key in `/etc/on/credentials/on-master-key` with root-only permissions. `runner-server.service` exposes it privately through systemd's credentials directory. Start the primary control plane with `systemctl enable --now runner.target`; enable `runner-worker.service` separately on worker machines. Use `systemctl edit runner-worker.service` for machine-specific labels and paths.
|
|
323
326
|
|
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RunnerConfig, UserRunnerConfig } from './types.js';
|
|
1
|
+
import type { RunnerConfig, UserRunnerConfig } from './types.js';
|
|
2
2
|
export declare function loadConfig(values: any): Promise<RunnerConfig | null>;
|
|
3
3
|
export declare function resolveConfig(configFromFile: UserRunnerConfig, configFromCli: UserRunnerConfig): RunnerConfig;
|
|
4
4
|
export declare function printHelp(): void;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGjE,wBAAsB,UAAU,CAAC,MAAM,KAAA,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAuBrE;AAED,wBAAgB,aAAa,CAAC,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,GAAG,YAAY,CAkC7G;AAED,wBAAgB,SAAS,SAuBxB;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC;IAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAuB9F"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/db-client.ts
|
|
2
|
+
var e = process.env.DATABASE_URL;
|
|
3
|
+
if (!e) throw Error("DATABASE_URL is required");
|
|
4
|
+
var t = await import(e), n = t.default || t;
|
|
5
|
+
if (!n || typeof n.get != "function" || typeof n.run != "function" || typeof n.all != "function" || typeof n.exec != "function") throw Error(`Database module ${e} does not expose get, run, all, and exec`);
|
|
6
|
+
n.get.bind(n), n.run.bind(n), n.all.bind(n), n.exec.bind(n), typeof n.pragma == "function" && n.pragma.bind(n), typeof n.transaction == "function" && n.transaction.bind(n), typeof n.schema == "function" && n.schema.bind(n), typeof n.clone == "function" && n.clone.bind(n);
|
|
7
|
+
//#endregion
|
|
8
|
+
export { n as t };
|
package/dist/db-client.d.ts
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
declare
|
|
2
|
-
export declare const get:
|
|
3
|
-
export declare const run:
|
|
4
|
-
export declare const all:
|
|
5
|
-
export declare const exec:
|
|
6
|
-
export declare
|
|
7
|
-
declare const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
all: (statement: string, data?: (string | number | null)[] | undefined, pragma?: string[] | undefined) => Promise<any>;
|
|
12
|
-
exec: (statement: string, data?: (string | number | null)[] | undefined, pragma?: string[] | undefined) => Promise<any>;
|
|
13
|
-
pragma: typeof pragma;
|
|
14
|
-
};
|
|
15
|
-
export default _default;
|
|
16
|
-
export declare function setUrl(u: any): void;
|
|
1
|
+
declare const db: any;
|
|
2
|
+
export declare const get: any;
|
|
3
|
+
export declare const run: any;
|
|
4
|
+
export declare const all: any;
|
|
5
|
+
export declare const exec: any;
|
|
6
|
+
export declare const pragma: any;
|
|
7
|
+
export declare const transaction: any;
|
|
8
|
+
export declare const schema: any;
|
|
9
|
+
export declare const clone: any;
|
|
10
|
+
export default db;
|
|
17
11
|
//# sourceMappingURL=db-client.d.ts.map
|
package/dist/db-client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-client.d.ts","sourceRoot":"","sources":["../src/db-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"db-client.d.ts","sourceRoot":"","sources":["../src/db-client.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,EAAE,KAA2B,CAAC;AAMpC,eAAO,MAAM,GAAG,KAAkB,CAAC;AACnC,eAAO,MAAM,GAAG,KAAkB,CAAC;AACnC,eAAO,MAAM,GAAG,KAAkB,CAAC;AACnC,eAAO,MAAM,IAAI,KAAmB,CAAC;AACrC,eAAO,MAAM,MAAM,KAAyE,CAAC;AAC7F,eAAO,MAAM,WAAW,KAA6E,CAAC;AACtG,eAAO,MAAM,MAAM,KAAmE,CAAC;AACvF,eAAO,MAAM,KAAK,KAAiE,CAAC;AAEpF,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/events.ts
|
|
2
|
+
var e = class {
|
|
3
|
+
clients = /* @__PURE__ */ new Map();
|
|
4
|
+
nextId = 1;
|
|
5
|
+
maxClients = 1e3;
|
|
6
|
+
subscribe(e, t) {
|
|
7
|
+
if (this.clients.size >= this.maxClients) {
|
|
8
|
+
t.writeHead(503, {
|
|
9
|
+
"Content-Type": "application/json",
|
|
10
|
+
"Retry-After": "5"
|
|
11
|
+
}), t.end(JSON.stringify({ error: "Too many event stream clients" }));
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
t.writeHead(200, {
|
|
15
|
+
"Cache-Control": "no-cache, no-transform",
|
|
16
|
+
Connection: "keep-alive",
|
|
17
|
+
"Content-Type": "text/event-stream",
|
|
18
|
+
"X-Accel-Buffering": "no"
|
|
19
|
+
}), t.write("retry: 2000\n\n");
|
|
20
|
+
let n = setInterval(() => t.write(": heartbeat\n\n"), 3e4);
|
|
21
|
+
n.unref(), this.clients.set(t, n), e.once("close", () => {
|
|
22
|
+
clearInterval(n), this.clients.delete(t);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
publish(e, t = {}) {
|
|
26
|
+
let n = `id: ${this.nextId++}\nevent: ${e}\ndata: ${JSON.stringify(t)}\n\n`;
|
|
27
|
+
for (let [e, t] of this.clients) e.write(n) || (clearInterval(t), this.clients.delete(e), e.end());
|
|
28
|
+
}
|
|
29
|
+
close() {
|
|
30
|
+
for (let [e, t] of this.clients) clearInterval(t), e.end();
|
|
31
|
+
this.clients.clear();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
async function t(e, t, n, r) {
|
|
35
|
+
let i = await fetch(new URL("/api/events", e), {
|
|
36
|
+
headers: { Accept: "text/event-stream" },
|
|
37
|
+
signal: t
|
|
38
|
+
});
|
|
39
|
+
if (!i.ok || !i.body) throw Error(`Event stream failed with HTTP ${i.status}`);
|
|
40
|
+
r?.();
|
|
41
|
+
let a = new TextDecoder(), o = "";
|
|
42
|
+
for await (let e of i.body) {
|
|
43
|
+
o += a.decode(e, { stream: !0 }).replaceAll("\r\n", "\n");
|
|
44
|
+
let t = o.indexOf("\n\n");
|
|
45
|
+
for (; t !== -1;) {
|
|
46
|
+
let e = o.slice(0, t);
|
|
47
|
+
o = o.slice(t + 2), t = o.indexOf("\n\n");
|
|
48
|
+
let r = e.match(/^event: (.+)$/m)?.[1];
|
|
49
|
+
if (!r) continue;
|
|
50
|
+
let i = e.match(/^data: (.*)$/m)?.[1];
|
|
51
|
+
n(r, i ? JSON.parse(i) : {});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { t as n, e as t };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC"}
|