@ship.zone/runner 0.2.3 → 1.0.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.
@@ -0,0 +1,14 @@
1
+ {
2
+ "format": "tsrust.build-provenance.v2",
3
+ "binarySha256": "d69a00882fd822a2afecf456c38dcf828c164ec7241ce1ecfb0365d94061932b",
4
+ "buildInfo": {
5
+ "projectName": "@ship.zone/runner",
6
+ "projectVersion": "1.0.0",
7
+ "gitCommit": "618325762e102834d7050653224a810bffc485e4",
8
+ "gitDirty": false,
9
+ "builtAt": "2026-09-27T13:31:21.535Z",
10
+ "tsrustVersion": "1.15.1",
11
+ "binary": "runnerworkspace",
12
+ "target": "linux_amd64_musl"
13
+ }
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "format": "tsrust.build-provenance.v2",
3
+ "binarySha256": "7775abaf87eeaaf41bc47607734e704e8c63b99fdcceeb6c692397536ba7b394",
4
+ "buildInfo": {
5
+ "projectName": "@ship.zone/runner",
6
+ "projectVersion": "1.0.0",
7
+ "gitCommit": "618325762e102834d7050653224a810bffc485e4",
8
+ "gitDirty": false,
9
+ "builtAt": "2026-09-27T13:31:29.997Z",
10
+ "tsrustVersion": "1.15.1",
11
+ "binary": "runnerworkspace",
12
+ "target": "linux_arm64_musl"
13
+ }
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ship.zone/runner",
3
- "version": "0.2.3",
3
+ "version": "1.0.0",
4
4
  "description": "The isolated OCI job runner for ship.zone CI/CD",
5
5
  "homepage": "https://code.foss.global/ship.zone/runner",
6
6
  "bugs": {
@@ -29,11 +29,11 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@foss.global/ci-spec": "0.2.0",
32
+ "@foss.global/ci-spec": "1.1.1",
33
33
  "ajv": "^8.20.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@git.zone/tsrust": "^1.7.0"
36
+ "@git.zone/tsrust": "^1.15.1"
37
37
  },
38
38
  "files": [
39
39
  "changelog.md",
package/readme.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # @ship.zone/runner
2
2
 
3
3
  `@ship.zone/runner` is the outbound-only OCI execution agent for ship.zone CI/CD. It implements the
4
- `foss-ci-runner/2.0-draft.2` protocol, validates compiled jobs against `@foss.global/ci-spec`, and
5
- runs one fenced attempt at a time on a local Docker or Podman engine.
4
+ runner protocol of `@foss.global/ci-spec` (1.1.1) for the `oci` execution profile, validates leases
5
+ and compiled jobs against the published schemas, and runs one fenced attempt at a time on a local
6
+ Docker or Podman engine.
6
7
 
7
8
  The control plane owns workflow compilation, scheduling, authorization, secrets policy, and
8
9
  canonical run state. This package owns runner registration, lease handling, isolated execution,
@@ -23,10 +24,13 @@ Requests directly.
23
24
  - Job images must be Linux images pinned by an exact SHA-256 digest. The image OS, architecture, and
24
25
  digest are checked before lease acceptance.
25
26
  - Every compiled step runs in a fresh container as a numeric non-root user with a read-only root,
26
- all capabilities dropped, `no-new-privileges`, private IPC, and CPU, memory, PID, time, and
27
- writable-storage limits.
28
- - Network mode defaults to `none`. `bridge` must be allowed by both runner policy and the compiled
29
- job; it is not an egress allowlist.
27
+ all capabilities dropped, `no-new-privileges`, private IPC, and CPU, memory, PID, shared-memory
28
+ (`/dev/shm`), time, and writable-storage limits. The job's `resources` are these ceilings; omitted
29
+ values take the runner defaults, and every value is bounded by the maximum the runner advertises.
30
+ - The only network mode is `none`: every step container runs in a new network namespace whose only
31
+ interface is its own loopback, so nothing leaves the sandbox and loopback ports never collide with
32
+ another attempt. The runner exposes no service on that loopback. `egress` allowlists are not
33
+ enforced by this runner, are never advertised, and cannot be configured.
30
34
  - Job containers receive no host paths, runtime sockets, devices, host namespaces, or arbitrary OCI
31
35
  arguments. Their only persistent writable mount is `/workspace`.
32
36
  - The shared workspace is an attempt-specific `nodev,nosuid` tmpfs with hard byte and entry
@@ -38,9 +42,15 @@ Requests directly.
38
42
  `CHOWN` and `DAC_OVERRIDE` capabilities required for private staging ownership. Job containers do
39
43
  not receive those capabilities.
40
44
  - Step containers receive exactly the compiled step environment plus job secrets. Secret values are
41
- passed through the runtime environment rather than OCI command arguments and are redacted from
42
- logs. Redaction is defense in depth: a malicious job can transform a secret or split it across
43
- streams, so the coordinator must not grant protected secrets to untrusted jobs.
45
+ passed through the runtime environment rather than OCI command arguments.
46
+ - The attempt's redaction set holds every secret value, every npm grant token, and each line of a
47
+ multi-line value, leaving out members shorter than 8 UTF-8 bytes. Every member is replaced with
48
+ `***` in log output, per stream and across the attempt's interleaved chunk sequence, so no chunk
49
+ and no concatenation of consecutive chunks contains one. An artifact or cache archive whose entry
50
+ path, link target, or file content contains a member is never published: a required artifact or a
51
+ cache completes the attempt `system_error`, an optional artifact is omitted and reported.
52
+ Redaction matches exact bytes; a job that transforms a value can still disclose it, so the
53
+ coordinator must not grant protected secrets to untrusted jobs.
44
54
 
45
55
  ## Requirements
46
56
 
@@ -159,9 +169,12 @@ Plain HTTP control planes are rejected except for explicitly enabled loopback de
159
169
 
160
170
  For each claim, the runner:
161
171
 
162
- 1. Validates the exact lease shape, compiled-job JSON Schema, RFC 8785 `compiledPlanDigest`,
163
- internal transfer/permission coherence, fit against the immutable advertised capability snapshot,
164
- and all runner execution policy before image inspection or pull.
172
+ 1. Validates the lease against the published `JobLease` schema, the compiled job against the runner
173
+ job schema and the specification version acceptance rule, the RFC 8785 `compiledPlanDigest`,
174
+ internal job coherence, the lease coherence of `grants`, `bindings`, and `npmGrants`, fit against
175
+ the immutable advertised capability snapshot, and all runner execution policy before image
176
+ inspection or pull. A lease that fails any check, or that this runner does not execute, is
177
+ abandoned as `runner_error` before acceptance.
165
178
  2. Pulls or locates the exact image digest, validates its Linux architecture, and probes it with the
166
179
  inert helper.
167
180
  3. Writes a private interrupted-attempt journal and sends the explicit fenced acceptance request.
@@ -181,9 +194,20 @@ workspace.
181
194
 
182
195
  On restart, a new session first removes stale labeled containers and volumes locally, scavenges only
183
196
  the runner's known host-staging directories and journal temporary files, then reads the secret-free
184
- journal and calls the v2 recovery endpoint to revoke and reconcile the interrupted attempt. Work is
197
+ journal and calls the recovery endpoint to revoke and reconcile the interrupted attempt. Work is
185
198
  never resumed, and a coordinator outage cannot retain prior staging.
186
199
 
200
+ ## Job Timeout
201
+
202
+ The attempt deadline is the job's `timeoutMs`, measured with a monotonic clock from the moment the
203
+ runner receives HTTP 204 for its acceptance. It covers source extraction, cache restoration, and
204
+ every step. When it is reached before execution ends, the runner terminates execution as for a
205
+ cancellation, force-stopping within the configured stop timeout of at most 30 seconds, archives the
206
+ artifacts declared `when: always` or `when: failure`, publishes no read-write cache, and completes
207
+ `timed_out`. Artifact collection and upload, cache publication, and completion follow execution and
208
+ are bounded only by the fence. Whichever of an accepted cancellation and the deadline comes first
209
+ decides the outcome: `canceled` or `timed_out`.
210
+
187
211
  ## Cancellation And Fencing
188
212
 
189
213
  Job heartbeats renew the coordinator-time lease and acknowledge cancellation directives. A
@@ -199,14 +223,31 @@ Logs use nested fenced identity, zero-based sequencing, exact acknowledgements,
199
223
  redaction, and UTF-8 byte limits. Reaching the negotiated total log limit fails closed and
200
224
  terminates the attempt as `system_error`; output is never silently truncated.
201
225
 
202
- ## Runner Protocol V2
226
+ ## Runner Protocol
227
+
228
+ The runner implements the specification version of the `@foss.global/ci-spec` package it is built
229
+ against (its `ciSpecVersion`, currently 1.1.1), and sends it as `spec` in registration and session
230
+ requests. It refuses a coordinator whose discovery, registration, or session `spec` has another
231
+ major version, and a coordinator answers a runner of another major version with HTTP 409
232
+ `spec_incompatible`. Messages other than compiled jobs use only constructs of the lower of both
233
+ versions; against a 1.0.0 coordinator the capability snapshot omits `resources`. A leased job is
234
+ accepted only when its `spec` has the same major version and is not newer than the implemented
235
+ version; any other job is abandoned as `runner_error`.
236
+
237
+ The runner advertises the `oci` profile, `container` isolation, the native `linux/<arch>` platform
238
+ of its verified OCI engine, the `none` network mode, its transfer limits, and `resources` maxima for
239
+ memory, CPUs, PIDs, and shared memory. It refuses, by abandoning the lease as `runner_error` before
240
+ acceptance, every lease it cannot execute as specified: the `vm` and `oci-image` profiles, `microvm`
241
+ isolation, `egress` networks, candidate images with `bindings`, image `grants`, and jobs with
242
+ `npmRead` and their `npmGrants`.
203
243
 
204
- All endpoints are below `/api/runner/v2`. Registration uses the one-time bootstrap bearer token;
205
- subsequent requests use the renewable runner credential.
244
+ All endpoints are below `/api/runner`. Registration uses the one-time bootstrap bearer token;
245
+ subsequent requests use the renewable runner credential. Every request body is validated against its
246
+ published OpenAPI component before it is sent, and every response before it is used.
206
247
 
207
248
  | Operation | Endpoint | Idempotency |
208
249
  | ---------------- | --------------------------------------------------------- | ------------------------------------------ |
209
- | Discover | `GET /api/runner/v2` | Public exact descriptor |
250
+ | Discover | `GET /api/runner` | Public exact descriptor |
210
251
  | Register | `POST runners/register` | `registrationRequestId` and canonical body |
211
252
  | Start session | `POST runners/{runnerId}/sessions` | `sessionRequestId` and canonical body |
212
253
  | Runner heartbeat | `POST runners/{runnerId}/heartbeat` | Current runner session |
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@ship.zone/runner',
6
- version: '0.2.3',
6
+ version: '1.0.0',
7
7
  description: 'The isolated OCI job runner for ship.zone CI/CD'
8
8
  }