@ship.zone/runner 0.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.
- package/.smartconfig.json +48 -0
- package/changelog.md +12 -0
- package/deno.json +41 -0
- package/deno.lock +1843 -0
- package/dist_npm/mod.d.ts +689 -0
- package/dist_npm/mod.js +8980 -0
- package/dist_rust/runnerworkspace_linux_amd64_musl +0 -0
- package/dist_rust/runnerworkspace_linux_arm64_musl +0 -0
- package/license.md +18 -0
- package/mod.ts +8 -0
- package/musl-copyright.md +81 -0
- package/package.json +58 -0
- package/readme.md +274 -0
- package/rust/.cargo/config.toml +5 -0
- package/rust/Cargo.lock +144 -0
- package/rust/Cargo.toml +17 -0
- package/rust/src/lib.rs +1784 -0
- package/rust/src/main.rs +6 -0
- package/third-party-licenses.md +95 -0
- package/ts/00_commitinfo_data.ts +8 -0
- package/ts/api-client.ts +1059 -0
- package/ts/artifact-manager.ts +218 -0
- package/ts/attempt-state.ts +190 -0
- package/ts/cache-manager.ts +431 -0
- package/ts/cli.ts +239 -0
- package/ts/config.ts +724 -0
- package/ts/errors.ts +68 -0
- package/ts/index.ts +13 -0
- package/ts/interfaces.ts +547 -0
- package/ts/log-sender.ts +134 -0
- package/ts/oci-executor.ts +2472 -0
- package/ts/plugins.ts +11 -0
- package/ts/protocol-validator.ts +535 -0
- package/ts/redactor.ts +41 -0
- package/ts/registration-state.ts +253 -0
- package/ts/runner.ts +1036 -0
- package/ts/source-workspace.ts +161 -0
- package/ts/staging-scavenger.ts +62 -0
- package/ts/transfer-archive.ts +1605 -0
- package/ts/validation.ts +77 -0
|
Binary file
|
|
Binary file
|
package/license.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Task Venture Capital GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
6
|
+
associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
7
|
+
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
|
8
|
+
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
12
|
+
portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
|
15
|
+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
16
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
|
|
17
|
+
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/mod.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# musl Copyright And License
|
|
2
|
+
|
|
3
|
+
The packaged static Linux helpers include musl libc 1.2.5 from the Rust target toolchain. The
|
|
4
|
+
following is the upstream musl `COPYRIGHT` notice.
|
|
5
|
+
|
|
6
|
+
musl as a whole is licensed under the following standard MIT license:
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2005-2020 Rich Felker, et al.
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
11
|
+
associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
12
|
+
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
|
13
|
+
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
17
|
+
portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
|
20
|
+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
|
|
22
|
+
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
23
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
+
|
|
25
|
+
Authors/contributors include:
|
|
26
|
+
|
|
27
|
+
A. Wilcox, Ada Worcester, Alex Dowad, Alex Suykov, Alexander Monakov, Andre McCurdy, Andrew Kelley,
|
|
28
|
+
Anthony G. Basile, Aric Belsito, Arvid Picciani, Bartosz Brachaczek, Benjamin Peterson, Bobby
|
|
29
|
+
Bingham, Boris Brezillon, Brent Cook, Chris Spiegel, Clement Vasseur, Daniel Micay, Daniel Sabogal,
|
|
30
|
+
Daurnimator, David Carlier, David Edelsohn, Denys Vlasenko, Dmitry Ivanov, Dmitry V. Levin, Drew
|
|
31
|
+
DeVault, Emil Renner Berthing, Fangrui Song, Felix Fietkau, Felix Janda, Gianluca Anzolin, Hauke
|
|
32
|
+
Mehrtens, He X, Hiltjo Posthuma, Isaac Dunham, Jaydeep Patil, Jens Gustedt, Jeremy Huntwork,
|
|
33
|
+
Jo-Philipp Wich, Joakim Sindholt, John Spencer, Julien Ramseier, Justin Cormack, Kaarle Ritvanen,
|
|
34
|
+
Khem Raj, Kylie McClain, Leah Neukirchen, Luca Barbato, Luka Perkov, Lynn Ochs, M Farkas-Dyck
|
|
35
|
+
(Strake), Mahesh Bodapati, Markus Wichmann, Masanori Ogino, Michael Clark, Michael Forney, Mikhail
|
|
36
|
+
Kremnyov, Natanael Copa, Nicholas J. Kain, orc, Pascal Cuoq, Patrick Oppenlander, Petr Hosek, Petr
|
|
37
|
+
Skocik, Pierre Carrier, Reini Urban, Rich Felker, Richard Pennington, Ryan Fairfax, Samuel Holland,
|
|
38
|
+
Segev Finer, Shiz, sin, Solar Designer, Stefan Kristiansson, Stefan O'Rear, Szabolcs Nagy, Timo
|
|
39
|
+
Teras, Trutz Behn, Will Dietz, William Haddon, and William Pitcock.
|
|
40
|
+
|
|
41
|
+
Portions of this software are derived from third-party works licensed under terms compatible with
|
|
42
|
+
the above MIT license:
|
|
43
|
+
|
|
44
|
+
The TRE regular expression implementation (`src/regex/reg*` and `src/regex/tre*`) is Copyright (c)
|
|
45
|
+
2001-2008 Ville Laurikari and licensed under a 2-clause BSD license. The included version was
|
|
46
|
+
heavily modified by Rich Felker in 2012.
|
|
47
|
+
|
|
48
|
+
Much of the math library code (`src/math/*` and `src/complex/*`) is Copyright (c) 1993, 2004 Sun
|
|
49
|
+
Microsystems; Copyright (c) 2003-2011 David Schultz; Copyright (c) 2003-2009 Steven G. Kargl;
|
|
50
|
+
Copyright (c) 2003-2009 Bruce D. Evans; Copyright (c) 2008 Stephen L. Moshier; or Copyright (c)
|
|
51
|
+
2017-2018 Arm Limited. The individual sources carry extremely permissive terms.
|
|
52
|
+
|
|
53
|
+
The ARM memcpy code (`src/string/arm/memcpy.S`) is Copyright (c) 2008 The Android Open Source
|
|
54
|
+
Project and licensed under a two-clause BSD license. It was taken from Bionic libc.
|
|
55
|
+
|
|
56
|
+
The AArch64 memcpy and memset code (`src/string/aarch64/*`) is Copyright (c) 1999-2019 Arm Limited.
|
|
57
|
+
|
|
58
|
+
The DES implementation (`src/crypt/crypt_des.c`) is Copyright (c) 1994 David Burren and licensed
|
|
59
|
+
under a BSD license. The blowfish crypt implementation was originally written by Solar Designer and
|
|
60
|
+
placed into the public domain, with a fallback permissive license for jurisdictions that may not
|
|
61
|
+
recognize the public domain.
|
|
62
|
+
|
|
63
|
+
The smoothsort implementation (`src/stdlib/qsort.c`) is Copyright (c) 2011 Lynn Ochs and licensed
|
|
64
|
+
under an MIT-style license.
|
|
65
|
+
|
|
66
|
+
The x86_64 port was written by Nicholas J. Kain and is licensed under the standard MIT terms. The
|
|
67
|
+
mips and microblaze ports were originally written by Richard Pennington for ellcc and adapted by
|
|
68
|
+
Rich Felker; they are licensed under the standard MIT terms. The mips64 port was contributed by
|
|
69
|
+
Imagination Technologies under the standard MIT terms. The powerpc port was originally written by
|
|
70
|
+
Richard Pennington and supplemented by John Spencer under the standard MIT terms.
|
|
71
|
+
|
|
72
|
+
All other files without copyright comments are original works produced for musl by Rich Felker or
|
|
73
|
+
one or more contributors listed above. Individual authorship is recorded in the musl version control
|
|
74
|
+
history.
|
|
75
|
+
|
|
76
|
+
Permission is additionally granted for public header files (`include/*` and `arch/*/bits/*`) and crt
|
|
77
|
+
files intended to be linked into applications (`crt/*`, `ldso/dlstart.c`, and `arch/*/crt_arch.h`)
|
|
78
|
+
to omit the copyright and permission notices otherwise required by the license and to be used
|
|
79
|
+
without attribution. These files include substantial contributions from Bobby Bingham, John Spencer,
|
|
80
|
+
Nicholas J. Kain, Rich Felker, Richard Pennington, Stefan Kristiansson, and Szabolcs Nagy, all of
|
|
81
|
+
whom explicitly granted that permission.
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ship.zone/runner",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The isolated OCI job runner for ship.zone CI/CD",
|
|
5
|
+
"homepage": "https://code.foss.global/ship.zone/runner",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://code.foss.global/ship.zone/runner/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://code.foss.global/ship.zone/runner.git"
|
|
12
|
+
},
|
|
13
|
+
"author": "Task Venture Capital GmbH",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./dist_npm/mod.js",
|
|
17
|
+
"types": "./dist_npm/mod.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist_npm/mod.d.ts",
|
|
21
|
+
"default": "./dist_npm/mod.js"
|
|
22
|
+
},
|
|
23
|
+
"./mod.js": {
|
|
24
|
+
"types": "./dist_npm/mod.d.ts",
|
|
25
|
+
"default": "./dist_npm/mod.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@foss.global/ci-spec": "0.1.0",
|
|
30
|
+
"ajv": "^8.20.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@git.zone/tsrust": "^1.7.0"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"changelog.md",
|
|
37
|
+
"dist_npm/mod.d.ts",
|
|
38
|
+
"dist_npm/mod.js",
|
|
39
|
+
"dist_rust/**/*",
|
|
40
|
+
"rust/Cargo.lock",
|
|
41
|
+
"rust/Cargo.toml",
|
|
42
|
+
"rust/.cargo/config.toml",
|
|
43
|
+
"rust/src/**/*",
|
|
44
|
+
"ts/**/*",
|
|
45
|
+
".smartconfig.json",
|
|
46
|
+
"deno.json",
|
|
47
|
+
"deno.lock",
|
|
48
|
+
"license.md",
|
|
49
|
+
"mod.ts",
|
|
50
|
+
"musl-copyright.md",
|
|
51
|
+
"readme.md",
|
|
52
|
+
"third-party-licenses.md"
|
|
53
|
+
],
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "deno task check && deno task bundle && tsrust",
|
|
56
|
+
"test": "deno task test && cargo test --manifest-path rust/Cargo.toml"
|
|
57
|
+
}
|
|
58
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# @ship.zone/runner
|
|
2
|
+
|
|
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.1` 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.
|
|
6
|
+
|
|
7
|
+
The control plane owns workflow compilation, scheduling, authorization, secrets policy, and
|
|
8
|
+
canonical run state. This package owns runner registration, lease handling, isolated execution,
|
|
9
|
+
bounded transfers, redacted logs, and terminal reporting.
|
|
10
|
+
|
|
11
|
+
## Issue Reporting and Security
|
|
12
|
+
|
|
13
|
+
For reporting bugs, issues, or security vulnerabilities, please visit
|
|
14
|
+
[community.foss.global/](https://community.foss.global/). This is the central community hub for all
|
|
15
|
+
issue reporting. Developers who sign and comply with our contribution agreement and go through
|
|
16
|
+
identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull
|
|
17
|
+
Requests directly.
|
|
18
|
+
|
|
19
|
+
## Security Model
|
|
20
|
+
|
|
21
|
+
- Only local Unix-socket Docker and Podman endpoints are accepted. Remote contexts and connections
|
|
22
|
+
are rejected before capabilities are advertised.
|
|
23
|
+
- Job images must be Linux images pinned by an exact SHA-256 digest. The image OS, architecture, and
|
|
24
|
+
digest are checked before lease acceptance.
|
|
25
|
+
- 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.
|
|
30
|
+
- Job containers receive no host paths, runtime sockets, devices, host namespaces, or arbitrary OCI
|
|
31
|
+
arguments. Their only persistent writable mount is `/workspace`.
|
|
32
|
+
- The shared workspace is an attempt-specific `nodev,nosuid` tmpfs with hard byte and entry
|
|
33
|
+
ceilings. Imported executable files may run directly from it. A trusted static Rust helper imports
|
|
34
|
+
source/cache staging, measures the workspace around every step, and exports only declared
|
|
35
|
+
artifact/cache paths.
|
|
36
|
+
- Helper containers use the exact job image only as an inert root filesystem. They override the
|
|
37
|
+
entrypoint with the packaged static helper, have no network, and receive only the narrowly scoped
|
|
38
|
+
`CHOWN` and `DAC_OVERRIDE` capabilities required for private staging ownership. Job containers do
|
|
39
|
+
not receive those capabilities.
|
|
40
|
+
- 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.
|
|
44
|
+
|
|
45
|
+
## Requirements
|
|
46
|
+
|
|
47
|
+
- Deno 2
|
|
48
|
+
- pnpm 11
|
|
49
|
+
- Docker or Podman on Linux
|
|
50
|
+
- A rootless runtime by default
|
|
51
|
+
- Rust and configured cross-compilers when building the packaged helpers from source
|
|
52
|
+
|
|
53
|
+
## Install
|
|
54
|
+
|
|
55
|
+
Add the published source package to a Deno project:
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
deno add npm:@ship.zone/runner
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Then import the package through the generated import-map name. The npm export resolves to the
|
|
62
|
+
prebuilt Deno JavaScript bundle and its rolled-up TypeScript declarations:
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import { ShipRunner } from '@ship.zone/runner';
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Without an import-map entry, use the npm package directly:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { ShipRunner } from 'npm:@ship.zone/runner@0.1.0';
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
For development in this repository, install dependencies and build the npm bundle plus the static
|
|
75
|
+
musl-based `linux_amd64` and `linux_arm64` helpers:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
pnpm install
|
|
79
|
+
pnpm build
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The published package includes `dist_rust/runnerworkspace_linux_amd64_musl` and
|
|
83
|
+
`dist_rust/runnerworkspace_linux_arm64_musl`, the Rust source and manifests,
|
|
84
|
+
`rust/.cargo/config.toml`, and the dependency notices. `oci.workspaceHelperPath` can select an
|
|
85
|
+
explicit absolute helper path for development or controlled deployments.
|
|
86
|
+
|
|
87
|
+
## Configure And Run
|
|
88
|
+
|
|
89
|
+
Create a private runner configuration:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
deno run --allow-env --allow-net --allow-read --allow-write --allow-run \
|
|
93
|
+
npm:@ship.zone/runner@0.1.0 init \
|
|
94
|
+
--control-plane https://foss.global \
|
|
95
|
+
--runtime-path /usr/bin/docker
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Register with a one-time bootstrap token, then start the daemon:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
SHIP_RUNNER_BOOTSTRAP_TOKEN='<one-time token>' \
|
|
102
|
+
deno run --allow-env --allow-net --allow-read --allow-write --allow-run \
|
|
103
|
+
npm:@ship.zone/runner@0.1.0 register
|
|
104
|
+
deno run --allow-env --allow-net --allow-read --allow-write --allow-run \
|
|
105
|
+
npm:@ship.zone/runner@0.1.0 run
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Replace `run` with `once` to claim at most one job or `config` to print the effective configuration
|
|
109
|
+
with credentials masked. Within this repository, `deno task dev -- <command>` is the equivalent
|
|
110
|
+
development invocation. `SHIP_RUNNER_CONFIG` selects a config path; the default is
|
|
111
|
+
`./runner.config.json`.
|
|
112
|
+
|
|
113
|
+
`init` writes the config with mode `0600`. Registration verifies the runtime and protocol discovery
|
|
114
|
+
document before advertising capabilities, durably journals the exact registration request without
|
|
115
|
+
the bootstrap token, then atomically replaces the bootstrap token with the returned runner
|
|
116
|
+
credential. An interrupted registration replays the journaled request and rejects configuration
|
|
117
|
+
drift. Credential rotation from session and runner-heartbeat responses is persisted before the new
|
|
118
|
+
credential becomes active.
|
|
119
|
+
|
|
120
|
+
The default policy includes:
|
|
121
|
+
|
|
122
|
+
- rootless Docker at `/usr/bin/docker`;
|
|
123
|
+
- labels for Linux, the current architecture, and OCI;
|
|
124
|
+
- network `none` only;
|
|
125
|
+
- job user `65532:65532`;
|
|
126
|
+
- a 4 GiB maximum logical workspace and 100,000 entries;
|
|
127
|
+
- bounded source, artifact, cache, log, environment, and staging limits;
|
|
128
|
+
- a 1 GiB free-space and 10,000-inode staging reserve.
|
|
129
|
+
|
|
130
|
+
Plain HTTP control planes are rejected except for explicitly enabled loopback development URLs.
|
|
131
|
+
|
|
132
|
+
## Execution Lifecycle
|
|
133
|
+
|
|
134
|
+
For each claim, the runner:
|
|
135
|
+
|
|
136
|
+
1. Validates the exact lease shape, compiled-job JSON Schema, RFC 8785 `compiledPlanDigest`,
|
|
137
|
+
internal transfer/permission coherence, fit against the immutable advertised capability snapshot,
|
|
138
|
+
and all runner execution policy before image inspection or pull.
|
|
139
|
+
2. Pulls or locates the exact image digest, validates its Linux architecture, and probes it with the
|
|
140
|
+
inert helper.
|
|
141
|
+
3. Writes a private interrupted-attempt journal and sends the explicit fenced acceptance request.
|
|
142
|
+
Source transfer and execution do not start before HTTP 204.
|
|
143
|
+
4. Downloads and validates the source `tar.gz`, then restores readable caches in declaration order
|
|
144
|
+
into private host staging.
|
|
145
|
+
5. Imports staging into the bounded tmpfs and runs compiled steps in declaration order, stopping at
|
|
146
|
+
the first non-zero exit.
|
|
147
|
+
6. Publishes successful read-write caches and artifacts selected by their `when` policy as
|
|
148
|
+
deterministic, replayable `tar.gz` transfers.
|
|
149
|
+
7. Cleans staging, helper/step containers, and the tmpfs volume before sending the idempotent
|
|
150
|
+
terminal completion, then clears the recovery journal after the coordinator accepts it.
|
|
151
|
+
|
|
152
|
+
An attempt-scoped inert holder container keeps Docker's local-driver tmpfs mounted while fresh step
|
|
153
|
+
and helper containers come and go. It runs no image-provided command and is removed with the
|
|
154
|
+
workspace.
|
|
155
|
+
|
|
156
|
+
On restart, a new session first removes stale labeled containers and volumes locally, scavenges only
|
|
157
|
+
the runner's known host-staging directories and journal temporary files, then reads the secret-free
|
|
158
|
+
journal and calls the v2 recovery endpoint to revoke and reconcile the interrupted attempt. Work is
|
|
159
|
+
never resumed, and a coordinator outage cannot retain prior staging.
|
|
160
|
+
|
|
161
|
+
## Cancellation And Fencing
|
|
162
|
+
|
|
163
|
+
Job heartbeats renew the coordinator-time lease and acknowledge cancellation directives. A
|
|
164
|
+
cancellation immediately begins termination, bounds TERM-to-KILL by the coordinator's `terminateBy`
|
|
165
|
+
deadline, and completes with the same cancellation request ID. Heartbeats continue during bounded
|
|
166
|
+
termination.
|
|
167
|
+
|
|
168
|
+
HTTP 409 fencing loss, authentication loss, or coordinator-time lease expiry stops work and
|
|
169
|
+
suppresses subsequent logs, transfers, and completion. Graceful runner shutdown abandons the exact
|
|
170
|
+
accepted identity instead of reporting a successful terminal result.
|
|
171
|
+
|
|
172
|
+
Logs use nested fenced identity, zero-based sequencing, exact acknowledgements, streaming secret
|
|
173
|
+
redaction, and UTF-8 byte limits. Reaching the negotiated total log limit fails closed and
|
|
174
|
+
terminates the attempt as `system_error`; output is never silently truncated.
|
|
175
|
+
|
|
176
|
+
## Runner Protocol V2
|
|
177
|
+
|
|
178
|
+
All endpoints are below `/api/runner/v2`. Registration uses the one-time bootstrap bearer token;
|
|
179
|
+
subsequent requests use the renewable runner credential.
|
|
180
|
+
|
|
181
|
+
| Operation | Endpoint | Idempotency |
|
|
182
|
+
| ---------------- | --------------------------------------------------------- | ------------------------------------------ |
|
|
183
|
+
| Discover | `GET /api/runner/v2` | Public exact descriptor |
|
|
184
|
+
| Register | `POST runners/register` | `registrationRequestId` and canonical body |
|
|
185
|
+
| Start session | `POST runners/{runnerId}/sessions` | `sessionRequestId` and canonical body |
|
|
186
|
+
| Runner heartbeat | `POST runners/{runnerId}/heartbeat` | Current runner session |
|
|
187
|
+
| Claim | `POST jobs/claim` | `claimRequestId` and capability snapshot |
|
|
188
|
+
| Accept | `POST jobs/{jobId}/attempts/{attemptId}/accept` | `acceptRequestId` and full identity |
|
|
189
|
+
| Job heartbeat | `POST jobs/{jobId}/attempts/{attemptId}/heartbeat` | Fenced identity |
|
|
190
|
+
| Log | `POST jobs/{jobId}/attempts/{attemptId}/logs` | Attempt and sequence |
|
|
191
|
+
| Complete | `POST jobs/{jobId}/attempts/{attemptId}/complete` | `completionRequestId` and terminal body |
|
|
192
|
+
| Abandon | `POST jobs/{jobId}/attempts/{attemptId}/abandon` | `abandonRequestId` and canonical body |
|
|
193
|
+
| Recover | `POST jobs/recover` | Current session and `recoveryRequestId` |
|
|
194
|
+
| Source | `GET sources/{sha256}` | Immutable attempt-bound digest |
|
|
195
|
+
| Artifact | `PUT jobs/{jobId}/attempts/{attemptId}/artifacts/{name}` | `transferRequestId` and metadata |
|
|
196
|
+
| Cache | `GET/PUT jobs/{jobId}/attempts/{attemptId}/caches/{name}` | Fenced declaration and transfer ID |
|
|
197
|
+
|
|
198
|
+
Transient retry statuses are 429, 502, 503, and 504. Exact retries reuse the same request ID and
|
|
199
|
+
canonical body. Request, response, archive, extracted-data, entry, and stream sizes are bounded.
|
|
200
|
+
|
|
201
|
+
## Library API
|
|
202
|
+
|
|
203
|
+
The package exports its runner components for controlled embedding:
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
import {
|
|
207
|
+
ArtifactManager,
|
|
208
|
+
CacheManager,
|
|
209
|
+
defaultRunnerConfig,
|
|
210
|
+
OciExecutor,
|
|
211
|
+
RunnerApiClient,
|
|
212
|
+
ShipRunner,
|
|
213
|
+
SourceWorkspaceManager,
|
|
214
|
+
} from '@ship.zone/runner';
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
The CLI is the supported complete assembly. Embedded callers must preserve the same runtime
|
|
218
|
+
verification, discovery, lifecycle, fencing, cleanup, and credential-persistence ordering.
|
|
219
|
+
|
|
220
|
+
## Verification
|
|
221
|
+
|
|
222
|
+
```sh
|
|
223
|
+
deno task fmt --check
|
|
224
|
+
deno task lint
|
|
225
|
+
deno task check
|
|
226
|
+
pnpm test
|
|
227
|
+
pnpm build
|
|
228
|
+
pnpm pack --dry-run
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
The real Docker integration is opt-in and requires a locally available digest-pinned Linux image:
|
|
232
|
+
|
|
233
|
+
```sh
|
|
234
|
+
SHIP_RUNNER_OCI_TEST=1 \
|
|
235
|
+
SHIP_RUNNER_OCI_IMAGE='alpine@sha256:<digest>' \
|
|
236
|
+
deno test --allow-all test/oci-executor.test.ts
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
It verifies direct execution of an imported workspace file, shared multi-step state, helper
|
|
240
|
+
ownership, selected export, hardlink rejection, inode exhaustion, and container/volume cleanup
|
|
241
|
+
against the real runtime.
|
|
242
|
+
|
|
243
|
+
## License and Legal Information
|
|
244
|
+
|
|
245
|
+
This repository contains open-source code licensed under the MIT License. A copy of the license can
|
|
246
|
+
be found in the [repository license file](./license.md). Dependency notices for the npm bundle and
|
|
247
|
+
the packaged static helper binaries are in [third-party-licenses.md](./third-party-licenses.md),
|
|
248
|
+
with the complete applicable musl inventory in [musl-copyright.md](./musl-copyright.md).
|
|
249
|
+
|
|
250
|
+
**Please note:** The MIT License does not grant permission to use the trade names, trademarks,
|
|
251
|
+
service marks, or product names of the project, except as required for reasonable and customary use
|
|
252
|
+
in describing the origin of the work and reproducing the content of the NOTICE file.
|
|
253
|
+
|
|
254
|
+
### Trademarks
|
|
255
|
+
|
|
256
|
+
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated
|
|
257
|
+
with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture
|
|
258
|
+
Capital GmbH or third parties, and are not included within the scope of the MIT license granted
|
|
259
|
+
herein.
|
|
260
|
+
|
|
261
|
+
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the
|
|
262
|
+
guidelines of the respective third-party owners, and any usage must be approved in writing.
|
|
263
|
+
Third-party trademarks used herein are the property of their respective owners and used only in a
|
|
264
|
+
descriptive manner, e.g. for an implementation of an API or similar.
|
|
265
|
+
|
|
266
|
+
### Company Information
|
|
267
|
+
|
|
268
|
+
Task Venture Capital GmbH<br> Registered at District Court Bremen HRB 35230 HB, Germany
|
|
269
|
+
|
|
270
|
+
For any legal inquiries or further information, please contact us via email at hello@task.vc.
|
|
271
|
+
|
|
272
|
+
By using this repository, you acknowledge that you have read this section, agree to comply with its
|
|
273
|
+
terms, and understand that the licensing of the code does not imply endorsement by Task Venture
|
|
274
|
+
Capital GmbH of any derivative works.
|
package/rust/Cargo.lock
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "bitflags"
|
|
7
|
+
version = "2.13.1"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "cfg-if"
|
|
13
|
+
version = "1.0.4"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "cfg_aliases"
|
|
19
|
+
version = "0.2.2"
|
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
+
checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527"
|
|
22
|
+
|
|
23
|
+
[[package]]
|
|
24
|
+
name = "itoa"
|
|
25
|
+
version = "1.0.18"
|
|
26
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
+
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
|
28
|
+
|
|
29
|
+
[[package]]
|
|
30
|
+
name = "libc"
|
|
31
|
+
version = "0.2.189"
|
|
32
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
33
|
+
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
|
|
34
|
+
|
|
35
|
+
[[package]]
|
|
36
|
+
name = "memchr"
|
|
37
|
+
version = "2.8.3"
|
|
38
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
39
|
+
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
|
40
|
+
|
|
41
|
+
[[package]]
|
|
42
|
+
name = "nix"
|
|
43
|
+
version = "0.30.1"
|
|
44
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
45
|
+
checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
|
|
46
|
+
dependencies = [
|
|
47
|
+
"bitflags",
|
|
48
|
+
"cfg-if",
|
|
49
|
+
"cfg_aliases",
|
|
50
|
+
"libc",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[[package]]
|
|
54
|
+
name = "proc-macro2"
|
|
55
|
+
version = "1.0.107"
|
|
56
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
57
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
58
|
+
dependencies = [
|
|
59
|
+
"unicode-ident",
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
[[package]]
|
|
63
|
+
name = "quote"
|
|
64
|
+
version = "1.0.47"
|
|
65
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
66
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
67
|
+
dependencies = [
|
|
68
|
+
"proc-macro2",
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
[[package]]
|
|
72
|
+
name = "runnerworkspace"
|
|
73
|
+
version = "0.1.0"
|
|
74
|
+
dependencies = [
|
|
75
|
+
"nix",
|
|
76
|
+
"serde",
|
|
77
|
+
"serde_json",
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
[[package]]
|
|
81
|
+
name = "serde"
|
|
82
|
+
version = "1.0.229"
|
|
83
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
84
|
+
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
|
|
85
|
+
dependencies = [
|
|
86
|
+
"serde_core",
|
|
87
|
+
"serde_derive",
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
[[package]]
|
|
91
|
+
name = "serde_core"
|
|
92
|
+
version = "1.0.229"
|
|
93
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
94
|
+
checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
|
|
95
|
+
dependencies = [
|
|
96
|
+
"serde_derive",
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
[[package]]
|
|
100
|
+
name = "serde_derive"
|
|
101
|
+
version = "1.0.229"
|
|
102
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
103
|
+
checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
|
104
|
+
dependencies = [
|
|
105
|
+
"proc-macro2",
|
|
106
|
+
"quote",
|
|
107
|
+
"syn",
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
[[package]]
|
|
111
|
+
name = "serde_json"
|
|
112
|
+
version = "1.0.151"
|
|
113
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
114
|
+
checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
|
|
115
|
+
dependencies = [
|
|
116
|
+
"itoa",
|
|
117
|
+
"memchr",
|
|
118
|
+
"serde",
|
|
119
|
+
"serde_core",
|
|
120
|
+
"zmij",
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
[[package]]
|
|
124
|
+
name = "syn"
|
|
125
|
+
version = "3.0.3"
|
|
126
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
127
|
+
checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
|
|
128
|
+
dependencies = [
|
|
129
|
+
"proc-macro2",
|
|
130
|
+
"quote",
|
|
131
|
+
"unicode-ident",
|
|
132
|
+
]
|
|
133
|
+
|
|
134
|
+
[[package]]
|
|
135
|
+
name = "unicode-ident"
|
|
136
|
+
version = "1.0.24"
|
|
137
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
138
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
139
|
+
|
|
140
|
+
[[package]]
|
|
141
|
+
name = "zmij"
|
|
142
|
+
version = "1.0.23"
|
|
143
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
144
|
+
checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
|
package/rust/Cargo.toml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "runnerworkspace"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
license = "MIT"
|
|
6
|
+
publish = false
|
|
7
|
+
|
|
8
|
+
[dependencies]
|
|
9
|
+
nix = { version = "0.30.1", default-features = false, features = ["fs", "signal"] }
|
|
10
|
+
serde = { version = "1.0.229", features = ["derive"] }
|
|
11
|
+
serde_json = "1.0.149"
|
|
12
|
+
|
|
13
|
+
[profile.release]
|
|
14
|
+
strip = true
|
|
15
|
+
lto = true
|
|
16
|
+
codegen-units = 1
|
|
17
|
+
panic = "abort"
|