@ship.zone/runner 0.2.4 → 1.1.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.1.0",
7
+ "gitCommit": "c4c2e312d0a24e51b2dd6e73e69d8e81a2296b00",
8
+ "gitDirty": false,
9
+ "builtAt": "2026-09-27T15:46:35.628Z",
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.1.0",
7
+ "gitCommit": "c4c2e312d0a24e51b2dd6e73e69d8e81a2296b00",
8
+ "gitDirty": false,
9
+ "builtAt": "2026-09-27T15:46:43.725Z",
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.4",
3
+ "version": "1.1.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.2.0",
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.2.0) 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,16 @@ 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
+ value containing a line terminator (CR LF, LF, or CR), leaving out members shorter than 8 UTF-8
48
+ bytes; a short line of a multi-line value stays unmasked when printed on its own. Every member is
49
+ replaced with `***` in log output, per stream and across the attempt's interleaved chunk sequence,
50
+ so no chunk and no concatenation of consecutive chunks contains one. An artifact or cache archive
51
+ whose entry path, link target, or file content contains a member is never published: a required
52
+ artifact or a cache completes the attempt `system_error`, an optional artifact is omitted and
53
+ reported. Redaction matches exact bytes; a job that transforms a value can still disclose it, so
54
+ the coordinator must not grant protected secrets to untrusted jobs.
44
55
 
45
56
  ## Requirements
46
57
 
@@ -159,9 +170,12 @@ Plain HTTP control planes are rejected except for explicitly enabled loopback de
159
170
 
160
171
  For each claim, the runner:
161
172
 
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.
173
+ 1. Validates the lease against the published `JobLease` schema, the compiled job against the runner
174
+ job schema and the specification version acceptance rule, the RFC 8785 `compiledPlanDigest`,
175
+ internal job coherence, the lease coherence of `grants`, `bindings`, and `npmGrants`, fit against
176
+ the immutable advertised capability snapshot, and all runner execution policy before image
177
+ inspection or pull. A lease that fails any check, or that this runner does not execute, is
178
+ abandoned as `runner_error` before acceptance.
165
179
  2. Pulls or locates the exact image digest, validates its Linux architecture, and probes it with the
166
180
  inert helper.
167
181
  3. Writes a private interrupted-attempt journal and sends the explicit fenced acceptance request.
@@ -181,9 +195,20 @@ workspace.
181
195
 
182
196
  On restart, a new session first removes stale labeled containers and volumes locally, scavenges only
183
197
  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
198
+ journal and calls the recovery endpoint to revoke and reconcile the interrupted attempt. Work is
185
199
  never resumed, and a coordinator outage cannot retain prior staging.
186
200
 
201
+ ## Job Timeout
202
+
203
+ The attempt deadline is the job's `timeoutMs`, measured with a monotonic clock from the moment the
204
+ runner receives HTTP 204 for its acceptance. It covers source extraction, cache restoration, and
205
+ every step. When it is reached before execution ends, the runner terminates execution as for a
206
+ cancellation, force-stopping within the configured stop timeout of at most 30 seconds, archives the
207
+ artifacts declared `when: always` or `when: failure`, publishes no read-write cache, and completes
208
+ `timed_out`. Artifact collection and upload, cache publication, and completion follow execution and
209
+ are bounded only by the fence. Whichever of an accepted cancellation and the deadline comes first
210
+ decides the outcome: `canceled` or `timed_out`.
211
+
187
212
  ## Cancellation And Fencing
188
213
 
189
214
  Job heartbeats renew the coordinator-time lease and acknowledge cancellation directives. A
@@ -199,14 +224,36 @@ Logs use nested fenced identity, zero-based sequencing, exact acknowledgements,
199
224
  redaction, and UTF-8 byte limits. Reaching the negotiated total log limit fails closed and
200
225
  terminates the attempt as `system_error`; output is never silently truncated.
201
226
 
202
- ## Runner Protocol V2
203
-
204
- All endpoints are below `/api/runner/v2`. Registration uses the one-time bootstrap bearer token;
205
- subsequent requests use the renewable runner credential.
227
+ ## Runner Protocol
228
+
229
+ The runner implements the specification version of the `@foss.global/ci-spec` package it is built
230
+ against (its `ciSpecVersion`, currently 1.2.0), and sends it as `spec` in registration and session
231
+ requests. It refuses a coordinator whose discovery, registration, or session `spec` has another
232
+ major version, and a coordinator answers a runner of another major version with HTTP 409
233
+ `spec_incompatible`. Messages other than compiled jobs use only constructs of the lower of both
234
+ versions: against a coordinator before 1.2.0 the capability snapshot omits `leaseFeatures` and
235
+ `maximumTimeoutMs`, and against a 1.0.0 coordinator also `resources`. A leased job is accepted only
236
+ when its `spec` has the same major version and is not newer than the implemented version; any other
237
+ job is abandoned as `runner_error`.
238
+
239
+ The runner advertises the `oci` profile, `container` isolation, the native `linux/<arch>` platform
240
+ of its verified OCI engine, the `none` network mode, its transfer limits, `resources` maxima for
241
+ memory, CPUs, PIDs, and shared memory, an empty `leaseFeatures` list because it uses no image pull
242
+ grants, candidate bindings, or npm read grants, and `maximumTimeoutMs`, its configured
243
+ `oci.maximumTimeoutMs`. It refuses, by abandoning the lease as `runner_error` before acceptance,
244
+ every lease it cannot execute as specified: the `vm` and `oci-image` profiles, `microvm` isolation,
245
+ `egress` networks, candidate images with `bindings`, image `grants`, jobs with `npmRead` and their
246
+ `npmGrants`, and jobs whose `timeoutMs` exceeds `oci.maximumTimeoutMs`. Leases with grants,
247
+ bindings, or npm grants are refused whatever the session version, also when the capability snapshot
248
+ carries no `leaseFeatures`.
249
+
250
+ All endpoints are below `/api/runner`. Registration uses the one-time bootstrap bearer token;
251
+ subsequent requests use the renewable runner credential. Every request body is validated against its
252
+ published OpenAPI component before it is sent, and every response before it is used.
206
253
 
207
254
  | Operation | Endpoint | Idempotency |
208
255
  | ---------------- | --------------------------------------------------------- | ------------------------------------------ |
209
- | Discover | `GET /api/runner/v2` | Public exact descriptor |
256
+ | Discover | `GET /api/runner` | Public exact descriptor |
210
257
  | Register | `POST runners/register` | `registrationRequestId` and canonical body |
211
258
  | Start session | `POST runners/{runnerId}/sessions` | `sessionRequestId` and canonical body |
212
259
  | 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.4',
6
+ version: '1.1.0',
7
7
  description: 'The isolated OCI job runner for ship.zone CI/CD'
8
8
  }