@ship.zone/runner 1.1.0 → 2.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.
- package/changelog.md +29 -0
- package/deno.json +13 -13
- package/deno.lock +7 -7
- package/dist_npm/mod.d.ts +3 -12
- package/dist_npm/mod.js +40 -64
- package/dist_rust/runnerworkspace_linux_amd64_musl.tsrust-build.json +3 -3
- package/dist_rust/runnerworkspace_linux_arm64_musl.tsrust-build.json +3 -3
- package/package.json +2 -2
- package/readme.md +14 -12
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/cli.ts +2 -7
- package/ts/interfaces.ts +3 -3
- package/ts/oci-executor.ts +11 -10
- package/ts/plugins.ts +4 -4
- package/ts/protocol-validator.ts +5 -5
- package/ts/runner.ts +2 -39
- package/ts/spec-version.ts +0 -11
- package/ts/wire-schema.ts +8 -7
package/changelog.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026-09-27 - 2.0.0
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
|
|
7
|
+
- speak the @ship.zone/ci-spec 2.0.0 runner protocol (protocol)
|
|
8
|
+
- Replace the deprecated `@foss.global/ci-spec` 1.2.0 with `@ship.zone/ci-spec` 2.0.0; the runner
|
|
9
|
+
implements and sends `spec` 2.0.0 and, under the same-major rule, refuses 1.x coordinators and
|
|
10
|
+
abandons 1.x jobs as `runner_error`.
|
|
11
|
+
- The reserved step environment names are `SHIPZONE_CI_MATRIX_JSON` and `SHIPZONE_CI_INPUTS_JSON`,
|
|
12
|
+
and secret targets and step environment names may not use any other `SHIPZONE_CI_*` name;
|
|
13
|
+
`FOSS_CI_*` names are no longer reserved.
|
|
14
|
+
- The compiled job schema and the OpenAPI components are registered under their 2.0.0 document
|
|
15
|
+
identifiers, `https://ship.zone/spec/ci/schemas/runner-job.schema.json` and
|
|
16
|
+
`https://ship.zone/spec/ci/spec/runner.openapi.json`, the job schema by its `$id` only.
|
|
17
|
+
- Capabilities always carry `resources`, the empty `leaseFeatures` list, and `maximumTimeoutMs`,
|
|
18
|
+
which are plain 2.0.0 capability fields; `capabilitiesForCoordinator`, `compareSpecVersions`,
|
|
19
|
+
and `lowerSpecVersion` are removed from the public API.
|
|
20
|
+
- The runner names its OCI containers and volumes `shipzone-ci-step-*`, `shipzone-ci-helper-*`,
|
|
21
|
+
`shipzone-ci-probe-*`, and `shipzone-ci-volume-*` instead of `foss-ci-*`, and reconciles only
|
|
22
|
+
the new names; operators of an earlier runner remove leftover `foss-ci-*` containers and volumes
|
|
23
|
+
by hand.
|
|
24
|
+
- The conformance map follows the 2.0.0 behavior cases: `capability-fields-negotiated` is gone,
|
|
25
|
+
and the 11 new behaviour cases are coordinator obligations.
|
|
26
|
+
|
|
27
|
+
### Maintenance
|
|
28
|
+
|
|
29
|
+
- exempt the ship.zone scope from the Deno release-age gate (deno)
|
|
30
|
+
- `deno.json` excludes `npm:@ship.zone/*` instead of `npm:@foss.global/*`, which no dependency uses any more.
|
|
31
|
+
|
|
3
32
|
## 2026-09-27 - 1.1.0
|
|
4
33
|
|
|
5
34
|
### Features
|
package/deno.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ship.zone/runner",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"exports": "./mod.ts",
|
|
5
5
|
"nodeModulesDir": "none",
|
|
6
6
|
"minimumDependencyAge": {
|
|
7
7
|
"age": "P1D",
|
|
8
8
|
"exclude": [
|
|
9
|
-
"npm:@foss.global/*",
|
|
10
9
|
"npm:@git.zone/*",
|
|
11
|
-
"npm:@push.rocks/*"
|
|
10
|
+
"npm:@push.rocks/*",
|
|
11
|
+
"npm:@ship.zone/*"
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
"tasks": {
|
|
15
15
|
"dev": "deno run --allow-all mod.ts",
|
|
16
|
-
"bundle": "deno bundle --frozen --check --platform=deno --keep-names --external '@
|
|
16
|
+
"bundle": "deno bundle --frozen --check --platform=deno --keep-names --external '@ship.zone/ci-spec' --external '@ship.zone/ci-spec/*' --external 'ajv/*' --declaration --outdir dist_npm mod.ts",
|
|
17
17
|
"test": "deno test --allow-env --allow-net --allow-read --allow-write --allow-run test/",
|
|
18
18
|
"check": "deno check mod.ts test/ scripts/",
|
|
19
19
|
"fmt": "deno fmt",
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
"strict": true
|
|
41
41
|
},
|
|
42
42
|
"imports": {
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
43
|
+
"@ship.zone/ci-spec": "npm:@ship.zone/ci-spec@2.0.0",
|
|
44
|
+
"@ship.zone/ci-spec/archive-cases.json": "npm:@ship.zone/ci-spec@2.0.0/archive-cases.json",
|
|
45
|
+
"@ship.zone/ci-spec/digest-cases.json": "npm:@ship.zone/ci-spec@2.0.0/digest-cases.json",
|
|
46
|
+
"@ship.zone/ci-spec/runner-cases.json": "npm:@ship.zone/ci-spec@2.0.0/runner-cases.json",
|
|
47
|
+
"@ship.zone/ci-spec/runner-job.schema.json": "npm:@ship.zone/ci-spec@2.0.0/runner-job.schema.json",
|
|
48
|
+
"@ship.zone/ci-spec/runner-messages.json": "npm:@ship.zone/ci-spec@2.0.0/runner-messages.json",
|
|
49
|
+
"@ship.zone/ci-spec/runner.openapi.json": "npm:@ship.zone/ci-spec@2.0.0/runner.openapi.json",
|
|
50
|
+
"@ship.zone/ci-spec/version-cases.json": "npm:@ship.zone/ci-spec@2.0.0/version-cases.json",
|
|
51
|
+
"@ship.zone/ci-spec/conformance/runner-jobs/": "npm:/@ship.zone/ci-spec@2.0.0/conformance/runner-jobs/",
|
|
52
52
|
"@std/assert": "jsr:@std/assert@^1.0.14",
|
|
53
53
|
"@std/path": "jsr:@std/path@^1.1.2",
|
|
54
54
|
"ajv/dist/2020.js": "npm:ajv@8.20.0/dist/2020.js"
|
package/deno.lock
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"jsr:@std/internal@^1.0.12": "1.0.14",
|
|
6
6
|
"jsr:@std/internal@^1.0.14": "1.0.14",
|
|
7
7
|
"jsr:@std/path@^1.1.2": "1.1.6",
|
|
8
|
-
"npm:@foss.global/ci-spec@1.2.0": "1.2.0",
|
|
9
8
|
"npm:@git.zone/tsrust@^1.15.1": "1.15.1",
|
|
9
|
+
"npm:@ship.zone/ci-spec@2.0.0": "2.0.0",
|
|
10
10
|
"npm:ajv@8.20.0": "8.20.0",
|
|
11
11
|
"npm:ajv@^8.20.0": "8.20.0"
|
|
12
12
|
},
|
|
@@ -103,10 +103,6 @@
|
|
|
103
103
|
],
|
|
104
104
|
"tarball": "https://verdaccio.lossless.digital/@design.estate/dees-element/-/dees-element-3.3.0.tgz"
|
|
105
105
|
},
|
|
106
|
-
"@foss.global/ci-spec@1.2.0": {
|
|
107
|
-
"integrity": "sha512-cQE0SZ8BRM1Tk6oSFg89LnD6Yx0cYTRuIb96nGPPIcqRFQzO0JVnz+dlzOt/+6dQW2HBjMIarvfdK5Q5B6LH3w==",
|
|
108
|
-
"tarball": "https://verdaccio.lossless.digital/@foss.global/ci-spec/-/ci-spec-1.2.0.tgz"
|
|
109
|
-
},
|
|
110
106
|
"@git.zone/tsrust@1.15.1": {
|
|
111
107
|
"integrity": "sha512-J7B5IrmIt6mE9T/SHGxzATvYQSpTrn0z2cEeeJtbeQEDxy/2rumra4fS8tjzuWxVHuET5HdlW/rILD9vc6fDLg==",
|
|
112
108
|
"dependencies": [
|
|
@@ -515,6 +511,10 @@
|
|
|
515
511
|
],
|
|
516
512
|
"tarball": "https://verdaccio.lossless.digital/@push.rocks/webstore/-/webstore-2.2.0.tgz"
|
|
517
513
|
},
|
|
514
|
+
"@ship.zone/ci-spec@2.0.0": {
|
|
515
|
+
"integrity": "sha512-W46vBiBCaapX84/CNaFazg5o/ibcVPv8qzRa1I9V952CAE0k2S/LuAsZCDBFSNfjzVWF2M4cHYEenERHqRUVXQ==",
|
|
516
|
+
"tarball": "https://verdaccio.lossless.digital/@ship.zone/ci-spec/-/ci-spec-2.0.0.tgz"
|
|
517
|
+
},
|
|
518
518
|
"@tempfix/lenis@1.3.20": {
|
|
519
519
|
"integrity": "sha512-ypeB0FuHLHOCQXW4d0RQ69txPJJH+1CHcpsZIUdcv2t1vR0IVyQr2vHihtde9UOXhjzqEnUphWon/UcJNsa0YA==",
|
|
520
520
|
"tarball": "https://verdaccio.lossless.digital/@tempfix/lenis/-/lenis-1.3.20.tgz"
|
|
@@ -1748,13 +1748,13 @@
|
|
|
1748
1748
|
"dependencies": [
|
|
1749
1749
|
"jsr:@std/assert@^1.0.14",
|
|
1750
1750
|
"jsr:@std/path@^1.1.2",
|
|
1751
|
-
"npm:@
|
|
1751
|
+
"npm:@ship.zone/ci-spec@2.0.0",
|
|
1752
1752
|
"npm:ajv@8.20.0"
|
|
1753
1753
|
],
|
|
1754
1754
|
"packageJson": {
|
|
1755
1755
|
"dependencies": [
|
|
1756
|
-
"npm:@foss.global/ci-spec@1.2.0",
|
|
1757
1756
|
"npm:@git.zone/tsrust@^1.15.1",
|
|
1757
|
+
"npm:@ship.zone/ci-spec@2.0.0",
|
|
1758
1758
|
"npm:ajv@^8.20.0"
|
|
1759
1759
|
]
|
|
1760
1760
|
}
|
package/dist_npm/mod.d.ts
CHANGED
|
@@ -159,11 +159,11 @@ export interface IRunnerCapabilities { executionProfiles: TExecutionProfile[];
|
|
|
159
159
|
networks: TNetworkMode[];
|
|
160
160
|
sourceFormats: TSourceFormat[];
|
|
161
161
|
limits: ITransferLimits;
|
|
162
|
-
/**
|
|
162
|
+
/** The largest resource ceilings the runner enforces per attempt. */
|
|
163
163
|
resources?: IResourceLimits;
|
|
164
|
-
/**
|
|
164
|
+
/** The lease contents the runner uses. */
|
|
165
165
|
leaseFeatures?: TLeaseFeature[];
|
|
166
|
-
/**
|
|
166
|
+
/** The largest job `timeoutMs` the runner executes. */
|
|
167
167
|
maximumTimeoutMs?: number;
|
|
168
168
|
}
|
|
169
169
|
export interface IRegisterRunnerRequest { registrationRequestId: string;
|
|
@@ -913,11 +913,6 @@ export interface IRunnerDependencies { api: IRunnerCoordinatorClient;
|
|
|
913
913
|
* image grants, candidate bindings, or npm read grants), and its configured longest job timeout.
|
|
914
914
|
*/
|
|
915
915
|
export declare const runnerCapabilities: (config: IRunnerConfig, runtime: Pick<IOciRuntimeFacts, "os" | "architecture">) => IRunnerCapabilities;
|
|
916
|
-
/**
|
|
917
|
-
* Restricts capabilities to the constructs defined at the lower of the coordinator and runner
|
|
918
|
-
* specification versions, the version every non-job message may use.
|
|
919
|
-
*/
|
|
920
|
-
export declare const capabilitiesForCoordinator: (capabilities: IRunnerCapabilities, discovery: Pick<IDiscoveryResponse, "spec">) => IRunnerCapabilities;
|
|
921
916
|
export declare const reconcileProtocolLimits: (config: IRunnerConfig, discovery: IDiscoveryResponse, capabilities: IRunnerCapabilities) => void;
|
|
922
917
|
export declare class ShipRunner { private readonly config;
|
|
923
918
|
private readonly dependencies;
|
|
@@ -959,10 +954,6 @@ export declare const runnerSpecVersion: string;
|
|
|
959
954
|
export declare const acceptSpecVersion: (implemented: string, declared: unknown) => TSpecAcceptance;
|
|
960
955
|
/** Returns whether two canonical versions share a major version, the coordinator session rule. */
|
|
961
956
|
export declare const specMajorVersionsMatch: (left: string, right: string) => boolean;
|
|
962
|
-
/** Compares two canonical specification versions numerically. */
|
|
963
|
-
export declare const compareSpecVersions: (left: string, right: string) => number;
|
|
964
|
-
/** The lower of two canonical versions: the version whose constructs a message may use. */
|
|
965
|
-
export declare const lowerSpecVersion: (left: string, right: string) => string;
|
|
966
957
|
export declare const scavengeRunnerStaging: (stateDirectory: string) => Promise<void>;
|
|
967
958
|
/** OpenAPI component schemas of the published runner protocol that this runner validates. */
|
|
968
959
|
export declare const wireSchemaNames: readonly ["AbandonJobRequest", "AcceptJobRequest", "ClaimJobRequest", "ClaimJobResponse", "CompleteJobRequest", "CompleteJobResponse", "DiscoveryResponse", "ErrorResponse", "ImageBinding", "ImageGrant", "ImageRecord", "JobHeartbeatRequest", "JobHeartbeatResponse", "JobLease", "LogAcknowledgement", "LogChunk", "NpmGrant", "RecordImageRequest", "RecoverAttemptRequest", "RegisterRunnerRequest", "RegisterRunnerResponse", "RunnerCapabilities", "RunnerHeartbeatRequest", "RunnerHeartbeatResponse", "StartSessionRequest", "StartSessionResponse", "TransferRecord"];
|
package/dist_npm/mod.js
CHANGED
|
@@ -104,17 +104,17 @@ var init_errors = __esm({
|
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
// ts/plugins.ts
|
|
107
|
-
import { ciSpecStatus, ciSpecVersion, executionProfileIdentifiers, maximumArchivePathMetadataBytes, runnerProtocolBasePath } from "@
|
|
107
|
+
import { ciSpecStatus, ciSpecVersion, executionProfileIdentifiers, maximumArchivePathMetadataBytes, runnerProtocolBasePath } from "@ship.zone/ci-spec";
|
|
108
108
|
import { Ajv2020 } from "ajv/dist/2020.js";
|
|
109
|
-
import runnerJobSchema from "@
|
|
110
|
-
import runnerOpenApi from "@
|
|
109
|
+
import runnerJobSchema from "@ship.zone/ci-spec/runner-job.schema.json" with { type: "json" };
|
|
110
|
+
import runnerOpenApi from "@ship.zone/ci-spec/runner.openapi.json" with { type: "json" };
|
|
111
111
|
var init_plugins = __esm({
|
|
112
112
|
"ts/plugins.ts"() {
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
// ts/spec-version.ts
|
|
117
|
-
var canonicalSpecVersionPattern, parseSpecVersion, requireCanonical, compareParts, runnerSpecVersion, acceptSpecVersion, specMajorVersionsMatch
|
|
117
|
+
var canonicalSpecVersionPattern, parseSpecVersion, requireCanonical, compareParts, runnerSpecVersion, acceptSpecVersion, specMajorVersionsMatch;
|
|
118
118
|
var init_spec_version = __esm({
|
|
119
119
|
"ts/spec-version.ts"() {
|
|
120
120
|
init_errors();
|
|
@@ -155,8 +155,6 @@ var init_spec_version = __esm({
|
|
|
155
155
|
return compareParts(declaredParts, implementedParts) > 0 ? "newer" : "accepted";
|
|
156
156
|
}, "acceptSpecVersion");
|
|
157
157
|
specMajorVersionsMatch = /* @__PURE__ */ __name((left, right) => requireCanonical(left, "Specification version").major === requireCanonical(right, "Specification version").major, "specMajorVersionsMatch");
|
|
158
|
-
compareSpecVersions = /* @__PURE__ */ __name((left, right) => compareParts(requireCanonical(left, "Specification version"), requireCanonical(right, "Specification version")), "compareSpecVersions");
|
|
159
|
-
lowerSpecVersion = /* @__PURE__ */ __name((left, right) => compareSpecVersions(left, right) <= 0 ? left : right, "lowerSpecVersion");
|
|
160
158
|
}
|
|
161
159
|
});
|
|
162
160
|
|
|
@@ -220,7 +218,7 @@ var init_validation = __esm({
|
|
|
220
218
|
});
|
|
221
219
|
|
|
222
220
|
// ts/wire-schema.ts
|
|
223
|
-
var wireSchemaNames, isWireSchemaName, openApiSchemaId,
|
|
221
|
+
var wireSchemaNames, isWireSchemaName, openApiSchemaId, runnerJobSchemaId, rewriteComponentReferences, componentSchemas, ajv, validatorCache, validatorFor, componentValidator, sanitizeErrorText, safeErrorDetails, assertValid, isValidWireMessage, validateWireMessage, validateCompiledJobSchema;
|
|
224
222
|
var init_wire_schema = __esm({
|
|
225
223
|
"ts/wire-schema.ts"() {
|
|
226
224
|
init_errors();
|
|
@@ -256,8 +254,8 @@ var init_wire_schema = __esm({
|
|
|
256
254
|
"TransferRecord"
|
|
257
255
|
];
|
|
258
256
|
isWireSchemaName = /* @__PURE__ */ __name((value) => typeof value === "string" && wireSchemaNames.includes(value), "isWireSchemaName");
|
|
259
|
-
openApiSchemaId = "https://
|
|
260
|
-
|
|
257
|
+
openApiSchemaId = "https://ship.zone/spec/ci/spec/runner.openapi.json";
|
|
258
|
+
runnerJobSchemaId = "https://ship.zone/spec/ci/schemas/runner-job.schema.json";
|
|
261
259
|
rewriteComponentReferences = /* @__PURE__ */ __name((value) => {
|
|
262
260
|
if (Array.isArray(value)) return value.map(rewriteComponentReferences);
|
|
263
261
|
if (!isRecord(value)) return value;
|
|
@@ -285,7 +283,7 @@ var init_wire_schema = __esm({
|
|
|
285
283
|
type: "string",
|
|
286
284
|
validate: isProtocolTimestamp
|
|
287
285
|
});
|
|
288
|
-
ajv.addSchema(runnerJobSchema
|
|
286
|
+
ajv.addSchema(runnerJobSchema);
|
|
289
287
|
ajv.addSchema({
|
|
290
288
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
291
289
|
$id: openApiSchemaId,
|
|
@@ -326,7 +324,7 @@ var init_wire_schema = __esm({
|
|
|
326
324
|
}, "assertValid");
|
|
327
325
|
isValidWireMessage = /* @__PURE__ */ __name((name, value) => componentValidator(name)(value) === true, "isValidWireMessage");
|
|
328
326
|
validateWireMessage = /* @__PURE__ */ __name((name, value) => assertValid(componentValidator(name), value, name), "validateWireMessage");
|
|
329
|
-
validateCompiledJobSchema = /* @__PURE__ */ __name((value) => assertValid(validatorFor(
|
|
327
|
+
validateCompiledJobSchema = /* @__PURE__ */ __name((value) => assertValid(validatorFor(runnerJobSchemaId), value, "Compiled runner job"), "validateCompiledJobSchema");
|
|
330
328
|
}
|
|
331
329
|
});
|
|
332
330
|
|
|
@@ -4960,20 +4958,20 @@ var init_deno = __esm({
|
|
|
4960
4958
|
"deno.json"() {
|
|
4961
4959
|
deno_default = {
|
|
4962
4960
|
name: "@ship.zone/runner",
|
|
4963
|
-
version: "
|
|
4961
|
+
version: "2.0.0",
|
|
4964
4962
|
exports: "./mod.ts",
|
|
4965
4963
|
nodeModulesDir: "none",
|
|
4966
4964
|
minimumDependencyAge: {
|
|
4967
4965
|
age: "P1D",
|
|
4968
4966
|
exclude: [
|
|
4969
|
-
"npm:@foss.global/*",
|
|
4970
4967
|
"npm:@git.zone/*",
|
|
4971
|
-
"npm:@push.rocks/*"
|
|
4968
|
+
"npm:@push.rocks/*",
|
|
4969
|
+
"npm:@ship.zone/*"
|
|
4972
4970
|
]
|
|
4973
4971
|
},
|
|
4974
4972
|
tasks: {
|
|
4975
4973
|
dev: "deno run --allow-all mod.ts",
|
|
4976
|
-
bundle: "deno bundle --frozen --check --platform=deno --keep-names --external '@
|
|
4974
|
+
bundle: "deno bundle --frozen --check --platform=deno --keep-names --external '@ship.zone/ci-spec' --external '@ship.zone/ci-spec/*' --external 'ajv/*' --declaration --outdir dist_npm mod.ts",
|
|
4977
4975
|
test: "deno test --allow-env --allow-net --allow-read --allow-write --allow-run test/",
|
|
4978
4976
|
check: "deno check mod.ts test/ scripts/",
|
|
4979
4977
|
fmt: "deno fmt",
|
|
@@ -5000,15 +4998,15 @@ var init_deno = __esm({
|
|
|
5000
4998
|
strict: true
|
|
5001
4999
|
},
|
|
5002
5000
|
imports: {
|
|
5003
|
-
"@
|
|
5004
|
-
"@
|
|
5005
|
-
"@
|
|
5006
|
-
"@
|
|
5007
|
-
"@
|
|
5008
|
-
"@
|
|
5009
|
-
"@
|
|
5010
|
-
"@
|
|
5011
|
-
"@
|
|
5001
|
+
"@ship.zone/ci-spec": "npm:@ship.zone/ci-spec@2.0.0",
|
|
5002
|
+
"@ship.zone/ci-spec/archive-cases.json": "npm:@ship.zone/ci-spec@2.0.0/archive-cases.json",
|
|
5003
|
+
"@ship.zone/ci-spec/digest-cases.json": "npm:@ship.zone/ci-spec@2.0.0/digest-cases.json",
|
|
5004
|
+
"@ship.zone/ci-spec/runner-cases.json": "npm:@ship.zone/ci-spec@2.0.0/runner-cases.json",
|
|
5005
|
+
"@ship.zone/ci-spec/runner-job.schema.json": "npm:@ship.zone/ci-spec@2.0.0/runner-job.schema.json",
|
|
5006
|
+
"@ship.zone/ci-spec/runner-messages.json": "npm:@ship.zone/ci-spec@2.0.0/runner-messages.json",
|
|
5007
|
+
"@ship.zone/ci-spec/runner.openapi.json": "npm:@ship.zone/ci-spec@2.0.0/runner.openapi.json",
|
|
5008
|
+
"@ship.zone/ci-spec/version-cases.json": "npm:@ship.zone/ci-spec@2.0.0/version-cases.json",
|
|
5009
|
+
"@ship.zone/ci-spec/conformance/runner-jobs/": "npm:/@ship.zone/ci-spec@2.0.0/conformance/runner-jobs/",
|
|
5012
5010
|
"@std/assert": "jsr:@std/assert@^1.0.14",
|
|
5013
5011
|
"@std/path": "jsr:@std/path@^1.1.2",
|
|
5014
5012
|
"ajv/dist/2020.js": "npm:ajv@8.20.0/dist/2020.js"
|
|
@@ -5452,8 +5450,8 @@ var init_oci_executor = __esm({
|
|
|
5452
5450
|
hostTmpfsProbeMaximumAgeMs = 60 * 60 * 1e3;
|
|
5453
5451
|
runtimeProbeVolumeMaximumAgeMs = 60 * 60 * 1e3;
|
|
5454
5452
|
runtimeProbeOwnerIdPattern = /^[a-f0-9]{32}$/;
|
|
5455
|
-
hostTmpfsProbeNamePattern = /^
|
|
5456
|
-
runtimeProbeVolumeNamePattern = /^
|
|
5453
|
+
hostTmpfsProbeNamePattern = /^shipzone-ci-probe-([a-f0-9]{32})-[a-f0-9]{16}$/;
|
|
5454
|
+
runtimeProbeVolumeNamePattern = /^shipzone-ci-volume-[a-f0-9]{32}$/;
|
|
5457
5455
|
workspaceHelperDirectoryName = "workspace-helpers";
|
|
5458
5456
|
workspaceHelperLockName = ".workspace-helper.lock";
|
|
5459
5457
|
runtimeProbeOwnerMarkerPrefix = ".runtime-probe-owner_";
|
|
@@ -5780,7 +5778,7 @@ var init_oci_executor = __esm({
|
|
|
5780
5778
|
}
|
|
5781
5779
|
}, "validateStepCommand");
|
|
5782
5780
|
validateGeneratedName = /* @__PURE__ */ __name((value, kind) => {
|
|
5783
|
-
const pattern = kind === "container" ? /^
|
|
5781
|
+
const pattern = kind === "container" ? /^shipzone-ci-(?:helper|probe|step)-[a-f0-9]{32}$/ : /^shipzone-ci-volume-[a-f0-9]{32}$/;
|
|
5784
5782
|
if (!pattern.test(value)) throw new ProtocolError(`Runner generated an invalid OCI ${kind} name`);
|
|
5785
5783
|
return value;
|
|
5786
5784
|
}, "validateGeneratedName");
|
|
@@ -5950,8 +5948,8 @@ var init_oci_executor = __esm({
|
|
|
5950
5948
|
sessionId: context.sessionId,
|
|
5951
5949
|
lease: context.lease,
|
|
5952
5950
|
step,
|
|
5953
|
-
containerName: `
|
|
5954
|
-
volumeName: `
|
|
5951
|
+
containerName: `shipzone-ci-step-${"0".repeat(32)}`,
|
|
5952
|
+
volumeName: `shipzone-ci-volume-${"0".repeat(32)}`
|
|
5955
5953
|
});
|
|
5956
5954
|
}
|
|
5957
5955
|
}, "validateLeasePolicy");
|
|
@@ -6422,7 +6420,7 @@ var init_oci_executor = __esm({
|
|
|
6422
6420
|
requireSuccess(containers, "Unable to enumerate orphan OCI containers");
|
|
6423
6421
|
for (const line of decode(containers.stdout).split("\n").filter(Boolean)) {
|
|
6424
6422
|
const [name, sessionId] = line.split("|", 2);
|
|
6425
|
-
if (/^
|
|
6423
|
+
if (/^shipzone-ci-(?:helper|probe|step)-[a-f0-9]{32}$/.test(name) && sessionId !== currentSessionId) {
|
|
6426
6424
|
await this.stopAndRemoveContainer(name);
|
|
6427
6425
|
}
|
|
6428
6426
|
}
|
|
@@ -6439,7 +6437,7 @@ var init_oci_executor = __esm({
|
|
|
6439
6437
|
requireSuccess(volumes, "Unable to enumerate orphan OCI volumes");
|
|
6440
6438
|
for (const line of decode(volumes.stdout).split("\n").filter(Boolean)) {
|
|
6441
6439
|
const [name, sessionId] = line.split("|", 2);
|
|
6442
|
-
if (/^
|
|
6440
|
+
if (/^shipzone-ci-volume-[a-f0-9]{32}$/.test(name) && sessionId !== currentSessionId) {
|
|
6443
6441
|
await this.removeVolume(name);
|
|
6444
6442
|
}
|
|
6445
6443
|
}
|
|
@@ -7107,7 +7105,7 @@ var init_oci_executor = __esm({
|
|
|
7107
7105
|
await scavengeHostTmpfsProbes("/dev/shm", {}, runtimeProbeOwnerId);
|
|
7108
7106
|
path = await Deno.makeTempDir({
|
|
7109
7107
|
dir: "/dev/shm",
|
|
7110
|
-
prefix: `
|
|
7108
|
+
prefix: `shipzone-ci-probe-${runtimeProbeOwnerId}-`
|
|
7111
7109
|
});
|
|
7112
7110
|
const before = await this.readFilesystemProbe(helperPath, path);
|
|
7113
7111
|
const first = join3(path, "first");
|
|
@@ -7819,7 +7817,7 @@ var init_oci_executor = __esm({
|
|
|
7819
7817
|
}
|
|
7820
7818
|
}
|
|
7821
7819
|
createResourceName(kind) {
|
|
7822
|
-
const name = `
|
|
7820
|
+
const name = `shipzone-ci-${kind}-${this.randomHex()}`;
|
|
7823
7821
|
return validateGeneratedName(name, kind === "volume" ? "volume" : "container");
|
|
7824
7822
|
}
|
|
7825
7823
|
randomHex() {
|
|
@@ -7849,8 +7847,8 @@ var init_protocol_validator = __esm({
|
|
|
7849
7847
|
init_wire_schema();
|
|
7850
7848
|
sha256Pattern3 = /^[a-f0-9]{64}$/;
|
|
7851
7849
|
reservedEnvironmentNames = [
|
|
7852
|
-
"
|
|
7853
|
-
"
|
|
7850
|
+
"SHIPZONE_CI_INPUTS_JSON",
|
|
7851
|
+
"SHIPZONE_CI_MATRIX_JSON"
|
|
7854
7852
|
];
|
|
7855
7853
|
npmUserConfigEnvironmentName = "NPM_CONFIG_USERCONFIG";
|
|
7856
7854
|
maximumCommandArgumentBytes2 = 16 * 1024;
|
|
@@ -8128,8 +8126,8 @@ var init_protocol_validator = __esm({
|
|
|
8128
8126
|
const secretTargets = Object.keys(job.secrets);
|
|
8129
8127
|
const npmRead = job.npmRead !== void 0;
|
|
8130
8128
|
for (const secretName of secretTargets) {
|
|
8131
|
-
if (secretName.startsWith("
|
|
8132
|
-
throw new ProtocolError("Secret targets may not use reserved
|
|
8129
|
+
if (secretName.startsWith("SHIPZONE_CI_")) {
|
|
8130
|
+
throw new ProtocolError("Secret targets may not use reserved SHIPZONE_CI names");
|
|
8133
8131
|
}
|
|
8134
8132
|
if (npmRead && secretName === npmUserConfigEnvironmentName) {
|
|
8135
8133
|
throw new ProtocolError(`Secret targets may not use the reserved ${secretName}`);
|
|
@@ -8152,8 +8150,8 @@ var init_protocol_validator = __esm({
|
|
|
8152
8150
|
for (const step of job.steps) {
|
|
8153
8151
|
const environmentNames = Object.keys(step.environment);
|
|
8154
8152
|
for (const name of environmentNames) {
|
|
8155
|
-
if (name.startsWith("
|
|
8156
|
-
throw new ProtocolError("Step environment uses an unknown reserved
|
|
8153
|
+
if (name.startsWith("SHIPZONE_CI_") && !reservedEnvironmentNames.includes(name)) {
|
|
8154
|
+
throw new ProtocolError("Step environment uses an unknown reserved SHIPZONE_CI name");
|
|
8157
8155
|
}
|
|
8158
8156
|
if (npmRead && name === npmUserConfigEnvironmentName) {
|
|
8159
8157
|
throw new ProtocolError(`Step environment may not define the reserved ${name}`);
|
|
@@ -8596,7 +8594,7 @@ var init_staging_scavenger = __esm({
|
|
|
8596
8594
|
});
|
|
8597
8595
|
|
|
8598
8596
|
// ts/runner.ts
|
|
8599
|
-
var identifierPattern4, genericSystemError, containsControlCharacter, defaultSleep2, identityFor, safeIdentityFromUnknown, isDefinitiveConflict, LeaseGuard,
|
|
8597
|
+
var identifierPattern4, genericSystemError, containsControlCharacter, defaultSleep2, identityFor, safeIdentityFromUnknown, isDefinitiveConflict, LeaseGuard, runnerCapabilities, reconcileProtocolLimits, ShipRunner;
|
|
8600
8598
|
var init_runner = __esm({
|
|
8601
8599
|
"ts/runner.ts"() {
|
|
8602
8600
|
init_attempt_state();
|
|
@@ -8705,8 +8703,6 @@ var init_runner = __esm({
|
|
|
8705
8703
|
if (this.timer !== void 0) clearTimeout(this.timer);
|
|
8706
8704
|
}
|
|
8707
8705
|
};
|
|
8708
|
-
resourceLimitsSpecVersion = "1.1.0";
|
|
8709
|
-
leaseMatchingSpecVersion = "1.2.0";
|
|
8710
8706
|
runnerCapabilities = /* @__PURE__ */ __name((config, runtime) => {
|
|
8711
8707
|
const artifactEnabled = config.maximumArtifacts > 0 && config.maximumArtifactBytes > 0 && config.maximumArtifactExtractedBytes > 0 && config.maximumArtifactEntries > 0;
|
|
8712
8708
|
const cacheEnabled = config.maximumCaches > 0 && config.maximumCacheArchiveBytes > 0 && config.maximumCacheExtractedBytes > 0 && config.maximumCacheEntries > 0;
|
|
@@ -8765,23 +8761,6 @@ var init_runner = __esm({
|
|
|
8765
8761
|
maximumTimeoutMs: config.oci.maximumTimeoutMs
|
|
8766
8762
|
});
|
|
8767
8763
|
}, "runnerCapabilities");
|
|
8768
|
-
capabilitiesForCoordinator = /* @__PURE__ */ __name((capabilities, discovery) => {
|
|
8769
|
-
const messageSpec = lowerSpecVersion(discovery.spec, runnerSpecVersion);
|
|
8770
|
-
const defines = /* @__PURE__ */ __name((since) => compareSpecVersions(messageSpec, since) >= 0, "defines");
|
|
8771
|
-
const { resources, leaseFeatures, maximumTimeoutMs, ...defined } = capabilities;
|
|
8772
|
-
return createRunnerCapabilitySnapshot({
|
|
8773
|
-
...defined,
|
|
8774
|
-
...resources !== void 0 && defines(resourceLimitsSpecVersion) ? {
|
|
8775
|
-
resources
|
|
8776
|
-
} : {},
|
|
8777
|
-
...leaseFeatures !== void 0 && defines(leaseMatchingSpecVersion) ? {
|
|
8778
|
-
leaseFeatures
|
|
8779
|
-
} : {},
|
|
8780
|
-
...maximumTimeoutMs !== void 0 && defines(leaseMatchingSpecVersion) ? {
|
|
8781
|
-
maximumTimeoutMs
|
|
8782
|
-
} : {}
|
|
8783
|
-
});
|
|
8784
|
-
}, "capabilitiesForCoordinator");
|
|
8785
8764
|
reconcileProtocolLimits = /* @__PURE__ */ __name((config, discovery, capabilities) => {
|
|
8786
8765
|
if (!specMajorVersionsMatch(discovery.spec, runnerSpecVersion)) {
|
|
8787
8766
|
throw new ProtocolError(`Coordinator specification ${discovery.spec} is incompatible with runner specification ${runnerSpecVersion}`);
|
|
@@ -8829,7 +8808,7 @@ var init_runner = __esm({
|
|
|
8829
8808
|
this.dependencies.api.setRunnerToken(this.config.runnerToken);
|
|
8830
8809
|
const runtime = await this.dependencies.executor.verifyRuntime();
|
|
8831
8810
|
const discovery = await this.dependencies.api.discover(options.signal);
|
|
8832
|
-
const capabilities =
|
|
8811
|
+
const capabilities = runnerCapabilities(this.config, runtime);
|
|
8833
8812
|
reconcileProtocolLimits(this.config, discovery, capabilities);
|
|
8834
8813
|
const validator = new RunnerProtocolValidator(capabilities);
|
|
8835
8814
|
const session = await this.dependencies.api.startSession({
|
|
@@ -9903,7 +9882,7 @@ Bootstrap credentials must be supplied through SHIP_RUNNER_BOOTSTRAP_TOKEN or th
|
|
|
9903
9882
|
const executor = new OciExecutor(config);
|
|
9904
9883
|
const runtime = await executor.verifyRuntime();
|
|
9905
9884
|
const discovery = await api.discover();
|
|
9906
|
-
const capabilities =
|
|
9885
|
+
const capabilities = runnerCapabilities(config, runtime);
|
|
9907
9886
|
reconcileProtocolLimits(config, discovery, capabilities);
|
|
9908
9887
|
const registered = await registerRunnerDurably({
|
|
9909
9888
|
configPath: path,
|
|
@@ -10047,8 +10026,6 @@ export {
|
|
|
10047
10026
|
buildOciRunCommand,
|
|
10048
10027
|
calculateWorkspaceVolumeLimits,
|
|
10049
10028
|
canonicalizeJson,
|
|
10050
|
-
capabilitiesForCoordinator,
|
|
10051
|
-
compareSpecVersions,
|
|
10052
10029
|
computeCompiledPlanDigest,
|
|
10053
10030
|
copyOciConfig,
|
|
10054
10031
|
createRunnerCapabilitySnapshot,
|
|
@@ -10056,7 +10033,6 @@ export {
|
|
|
10056
10033
|
isValidWireMessage,
|
|
10057
10034
|
isWireSchemaName,
|
|
10058
10035
|
loadRunnerConfig,
|
|
10059
|
-
lowerSpecVersion,
|
|
10060
10036
|
maskRunnerConfig,
|
|
10061
10037
|
minimumRedactionMemberBytes,
|
|
10062
10038
|
parseRunnerConfig,
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
"binarySha256": "d69a00882fd822a2afecf456c38dcf828c164ec7241ce1ecfb0365d94061932b",
|
|
4
4
|
"buildInfo": {
|
|
5
5
|
"projectName": "@ship.zone/runner",
|
|
6
|
-
"projectVersion": "
|
|
7
|
-
"gitCommit": "
|
|
6
|
+
"projectVersion": "2.0.0",
|
|
7
|
+
"gitCommit": "a6f054f5aa45bfe86054b7a266d836d7318c4546",
|
|
8
8
|
"gitDirty": false,
|
|
9
|
-
"builtAt": "2026-09-
|
|
9
|
+
"builtAt": "2026-09-27T19:54:14.422Z",
|
|
10
10
|
"tsrustVersion": "1.15.1",
|
|
11
11
|
"binary": "runnerworkspace",
|
|
12
12
|
"target": "linux_amd64_musl"
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
"binarySha256": "7775abaf87eeaaf41bc47607734e704e8c63b99fdcceeb6c692397536ba7b394",
|
|
4
4
|
"buildInfo": {
|
|
5
5
|
"projectName": "@ship.zone/runner",
|
|
6
|
-
"projectVersion": "
|
|
7
|
-
"gitCommit": "
|
|
6
|
+
"projectVersion": "2.0.0",
|
|
7
|
+
"gitCommit": "a6f054f5aa45bfe86054b7a266d836d7318c4546",
|
|
8
8
|
"gitDirty": false,
|
|
9
|
-
"builtAt": "2026-09-
|
|
9
|
+
"builtAt": "2026-09-27T19:54:22.712Z",
|
|
10
10
|
"tsrustVersion": "1.15.1",
|
|
11
11
|
"binary": "runnerworkspace",
|
|
12
12
|
"target": "linux_arm64_musl"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ship.zone/runner",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.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,7 +29,7 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@
|
|
32
|
+
"@ship.zone/ci-spec": "2.0.0",
|
|
33
33
|
"ajv": "^8.20.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
package/readme.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
|
-
runner protocol of `@
|
|
4
|
+
runner protocol of `@ship.zone/ci-spec` (2.0.0) for the `oci` execution profile, validates leases
|
|
5
5
|
and compiled jobs against the published schemas, and runs one fenced attempt at a time on a local
|
|
6
6
|
Docker or Podman engine.
|
|
7
7
|
|
|
@@ -226,15 +226,15 @@ terminates the attempt as `system_error`; output is never silently truncated.
|
|
|
226
226
|
|
|
227
227
|
## Runner Protocol
|
|
228
228
|
|
|
229
|
-
The runner implements the specification version of the `@
|
|
230
|
-
against (its `ciSpecVersion`, currently
|
|
229
|
+
The runner implements the specification version of the `@ship.zone/ci-spec` package it is built
|
|
230
|
+
against (its `ciSpecVersion`, currently 2.0.0), and sends it as `spec` in registration and session
|
|
231
231
|
requests. It refuses a coordinator whose discovery, registration, or session `spec` has another
|
|
232
|
-
major version,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
232
|
+
major version, so a 2.x runner never talks to a 1.x (`@foss.global/ci-spec`) coordinator, and a
|
|
233
|
+
coordinator answers a runner of another major version with HTTP 409 `spec_incompatible`. Every
|
|
234
|
+
capability the runner advertises is defined in 2.0.0, so it sends the same capability snapshot to
|
|
235
|
+
every coordinator of major version 2. A leased job is accepted only when its `spec` has the same
|
|
236
|
+
major version and is not newer than the implemented version; any other job is abandoned as
|
|
237
|
+
`runner_error`.
|
|
238
238
|
|
|
239
239
|
The runner advertises the `oci` profile, `container` isolation, the native `linux/<arch>` platform
|
|
240
240
|
of its verified OCI engine, the `none` network mode, its transfer limits, `resources` maxima for
|
|
@@ -243,9 +243,11 @@ grants, candidate bindings, or npm read grants, and `maximumTimeoutMs`, its conf
|
|
|
243
243
|
`oci.maximumTimeoutMs`. It refuses, by abandoning the lease as `runner_error` before acceptance,
|
|
244
244
|
every lease it cannot execute as specified: the `vm` and `oci-image` profiles, `microvm` isolation,
|
|
245
245
|
`egress` networks, candidate images with `bindings`, image `grants`, jobs with `npmRead` and their
|
|
246
|
-
`npmGrants`, and jobs whose `timeoutMs` exceeds `oci.maximumTimeoutMs`.
|
|
247
|
-
|
|
248
|
-
|
|
246
|
+
`npmGrants`, and jobs whose `timeoutMs` exceeds `oci.maximumTimeoutMs`.
|
|
247
|
+
|
|
248
|
+
The reserved step environment names are `SHIPZONE_CI_MATRIX_JSON` and `SHIPZONE_CI_INPUTS_JSON`,
|
|
249
|
+
each carrying canonical RFC 8785 JSON. A job whose step environment defines any other
|
|
250
|
+
`SHIPZONE_CI_*` name, or whose secret targets use any `SHIPZONE_CI_*` name, is rejected.
|
|
249
251
|
|
|
250
252
|
All endpoints are below `/api/runner`. Registration uses the one-time bootstrap bearer token;
|
|
251
253
|
subsequent requests use the renewable runner credential. Every request body is validated against its
|
package/ts/00_commitinfo_data.ts
CHANGED
package/ts/cli.ts
CHANGED
|
@@ -19,12 +19,7 @@ import type {
|
|
|
19
19
|
import { runnerVersion } from './interfaces.ts';
|
|
20
20
|
import { OciExecutor } from './oci-executor.ts';
|
|
21
21
|
import { RegistrationStateStore } from './registration-state.ts';
|
|
22
|
-
import {
|
|
23
|
-
capabilitiesForCoordinator,
|
|
24
|
-
reconcileProtocolLimits,
|
|
25
|
-
runnerCapabilities,
|
|
26
|
-
ShipRunner,
|
|
27
|
-
} from './runner.ts';
|
|
22
|
+
import { reconcileProtocolLimits, runnerCapabilities, ShipRunner } from './runner.ts';
|
|
28
23
|
import { runnerSpecVersion } from './spec-version.ts';
|
|
29
24
|
import { SourceWorkspaceManager } from './source-workspace.ts';
|
|
30
25
|
|
|
@@ -156,7 +151,7 @@ const runRegister = async (options: Map<string, string | true>): Promise<void> =
|
|
|
156
151
|
const executor = new OciExecutor(config);
|
|
157
152
|
const runtime = await executor.verifyRuntime();
|
|
158
153
|
const discovery = await api.discover();
|
|
159
|
-
const capabilities =
|
|
154
|
+
const capabilities = runnerCapabilities(config, runtime);
|
|
160
155
|
reconcileProtocolLimits(config, discovery, capabilities);
|
|
161
156
|
const registered = await registerRunnerDurably({
|
|
162
157
|
configPath: path,
|
package/ts/interfaces.ts
CHANGED
|
@@ -90,11 +90,11 @@ export interface IRunnerCapabilities {
|
|
|
90
90
|
networks: TNetworkMode[];
|
|
91
91
|
sourceFormats: TSourceFormat[];
|
|
92
92
|
limits: ITransferLimits;
|
|
93
|
-
/**
|
|
93
|
+
/** The largest resource ceilings the runner enforces per attempt. */
|
|
94
94
|
resources?: IResourceLimits;
|
|
95
|
-
/**
|
|
95
|
+
/** The lease contents the runner uses. */
|
|
96
96
|
leaseFeatures?: TLeaseFeature[];
|
|
97
|
-
/**
|
|
97
|
+
/** The largest job `timeoutMs` the runner executes. */
|
|
98
98
|
maximumTimeoutMs?: number;
|
|
99
99
|
}
|
|
100
100
|
|
package/ts/oci-executor.ts
CHANGED
|
@@ -56,8 +56,8 @@ const maximumWorkspaceHelperErrorBytes = 512;
|
|
|
56
56
|
const hostTmpfsProbeMaximumAgeMs = 60 * 60 * 1000;
|
|
57
57
|
const runtimeProbeVolumeMaximumAgeMs = 60 * 60 * 1000;
|
|
58
58
|
const runtimeProbeOwnerIdPattern = /^[a-f0-9]{32}$/;
|
|
59
|
-
const hostTmpfsProbeNamePattern = /^
|
|
60
|
-
const runtimeProbeVolumeNamePattern = /^
|
|
59
|
+
const hostTmpfsProbeNamePattern = /^shipzone-ci-probe-([a-f0-9]{32})-[a-f0-9]{16}$/;
|
|
60
|
+
const runtimeProbeVolumeNamePattern = /^shipzone-ci-volume-[a-f0-9]{32}$/;
|
|
61
61
|
const workspaceHelperDirectoryName = 'workspace-helpers';
|
|
62
62
|
const workspaceHelperLockName = '.workspace-helper.lock';
|
|
63
63
|
const runtimeProbeOwnerMarkerPrefix = '.runtime-probe-owner_';
|
|
@@ -573,8 +573,8 @@ const validateStepCommand = (command: string[]): void => {
|
|
|
573
573
|
|
|
574
574
|
const validateGeneratedName = (value: string, kind: 'container' | 'volume'): string => {
|
|
575
575
|
const pattern = kind === 'container'
|
|
576
|
-
? /^
|
|
577
|
-
: /^
|
|
576
|
+
? /^shipzone-ci-(?:helper|probe|step)-[a-f0-9]{32}$/
|
|
577
|
+
: /^shipzone-ci-volume-[a-f0-9]{32}$/;
|
|
578
578
|
if (!pattern.test(value)) throw new ProtocolError(`Runner generated an invalid OCI ${kind} name`);
|
|
579
579
|
return value;
|
|
580
580
|
};
|
|
@@ -839,8 +839,8 @@ const validateLeasePolicy = (
|
|
|
839
839
|
sessionId: context.sessionId,
|
|
840
840
|
lease: context.lease,
|
|
841
841
|
step,
|
|
842
|
-
containerName: `
|
|
843
|
-
volumeName: `
|
|
842
|
+
containerName: `shipzone-ci-step-${'0'.repeat(32)}`,
|
|
843
|
+
volumeName: `shipzone-ci-volume-${'0'.repeat(32)}`,
|
|
844
844
|
});
|
|
845
845
|
}
|
|
846
846
|
};
|
|
@@ -1387,7 +1387,8 @@ export class OciExecutor implements IJobExecutor {
|
|
|
1387
1387
|
for (const line of decode(containers.stdout).split('\n').filter(Boolean)) {
|
|
1388
1388
|
const [name, sessionId] = line.split('|', 2);
|
|
1389
1389
|
if (
|
|
1390
|
-
/^
|
|
1390
|
+
/^shipzone-ci-(?:helper|probe|step)-[a-f0-9]{32}$/.test(name) &&
|
|
1391
|
+
sessionId !== currentSessionId
|
|
1391
1392
|
) {
|
|
1392
1393
|
await this.stopAndRemoveContainer(name);
|
|
1393
1394
|
}
|
|
@@ -1405,7 +1406,7 @@ export class OciExecutor implements IJobExecutor {
|
|
|
1405
1406
|
requireSuccess(volumes, 'Unable to enumerate orphan OCI volumes');
|
|
1406
1407
|
for (const line of decode(volumes.stdout).split('\n').filter(Boolean)) {
|
|
1407
1408
|
const [name, sessionId] = line.split('|', 2);
|
|
1408
|
-
if (/^
|
|
1409
|
+
if (/^shipzone-ci-volume-[a-f0-9]{32}$/.test(name) && sessionId !== currentSessionId) {
|
|
1409
1410
|
await this.removeVolume(name);
|
|
1410
1411
|
}
|
|
1411
1412
|
}
|
|
@@ -2315,7 +2316,7 @@ export class OciExecutor implements IJobExecutor {
|
|
|
2315
2316
|
await scavengeHostTmpfsProbes('/dev/shm', {}, runtimeProbeOwnerId);
|
|
2316
2317
|
path = await Deno.makeTempDir({
|
|
2317
2318
|
dir: '/dev/shm',
|
|
2318
|
-
prefix: `
|
|
2319
|
+
prefix: `shipzone-ci-probe-${runtimeProbeOwnerId}-`,
|
|
2319
2320
|
});
|
|
2320
2321
|
const before = await this.readFilesystemProbe(helperPath, path);
|
|
2321
2322
|
const first = join(path, 'first');
|
|
@@ -3117,7 +3118,7 @@ export class OciExecutor implements IJobExecutor {
|
|
|
3117
3118
|
}
|
|
3118
3119
|
|
|
3119
3120
|
private createResourceName(kind: 'helper' | 'probe' | 'step' | 'volume'): string {
|
|
3120
|
-
const name = `
|
|
3121
|
+
const name = `shipzone-ci-${kind}-${this.randomHex()}`;
|
|
3121
3122
|
return validateGeneratedName(name, kind === 'volume' ? 'volume' : 'container');
|
|
3122
3123
|
}
|
|
3123
3124
|
|
package/ts/plugins.ts
CHANGED
|
@@ -4,16 +4,16 @@ export {
|
|
|
4
4
|
executionProfileIdentifiers,
|
|
5
5
|
maximumArchivePathMetadataBytes,
|
|
6
6
|
runnerProtocolBasePath,
|
|
7
|
-
} from '@
|
|
7
|
+
} from '@ship.zone/ci-spec';
|
|
8
8
|
|
|
9
9
|
export const loadCiSpecArchiveCases = async (): Promise<unknown> =>
|
|
10
|
-
(await import('@
|
|
10
|
+
(await import('@ship.zone/ci-spec/archive-cases.json', { with: { type: 'json' } })).default;
|
|
11
11
|
|
|
12
12
|
import { Ajv2020 } from 'ajv/dist/2020.js';
|
|
13
13
|
export { Ajv2020 };
|
|
14
14
|
|
|
15
|
-
import runnerJobSchema from '@
|
|
15
|
+
import runnerJobSchema from '@ship.zone/ci-spec/runner-job.schema.json' with { type: 'json' };
|
|
16
16
|
export { runnerJobSchema };
|
|
17
17
|
|
|
18
|
-
import runnerOpenApi from '@
|
|
18
|
+
import runnerOpenApi from '@ship.zone/ci-spec/runner.openapi.json' with { type: 'json' };
|
|
19
19
|
export { runnerOpenApi };
|
package/ts/protocol-validator.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { isRecord } from './validation.ts';
|
|
|
17
17
|
import { validateCompiledJobSchema, validateWireMessage } from './wire-schema.ts';
|
|
18
18
|
|
|
19
19
|
const sha256Pattern = /^[a-f0-9]{64}$/;
|
|
20
|
-
const reservedEnvironmentNames = ['
|
|
20
|
+
const reservedEnvironmentNames = ['SHIPZONE_CI_INPUTS_JSON', 'SHIPZONE_CI_MATRIX_JSON'] as const;
|
|
21
21
|
const npmUserConfigEnvironmentName = 'NPM_CONFIG_USERCONFIG';
|
|
22
22
|
const maximumCommandArgumentBytes = 16 * 1024;
|
|
23
23
|
const maximumCommandBytes = 128 * 1024;
|
|
@@ -331,8 +331,8 @@ const requireExecutionCoherence = (job: TCompiledRunnerJob): void => {
|
|
|
331
331
|
const secretTargets = Object.keys(job.secrets);
|
|
332
332
|
const npmRead = job.npmRead !== undefined;
|
|
333
333
|
for (const secretName of secretTargets) {
|
|
334
|
-
if (secretName.startsWith('
|
|
335
|
-
throw new ProtocolError('Secret targets may not use reserved
|
|
334
|
+
if (secretName.startsWith('SHIPZONE_CI_')) {
|
|
335
|
+
throw new ProtocolError('Secret targets may not use reserved SHIPZONE_CI names');
|
|
336
336
|
}
|
|
337
337
|
if (npmRead && secretName === npmUserConfigEnvironmentName) {
|
|
338
338
|
throw new ProtocolError(`Secret targets may not use the reserved ${secretName}`);
|
|
@@ -357,11 +357,11 @@ const requireExecutionCoherence = (job: TCompiledRunnerJob): void => {
|
|
|
357
357
|
const environmentNames = Object.keys(step.environment);
|
|
358
358
|
for (const name of environmentNames) {
|
|
359
359
|
if (
|
|
360
|
-
name.startsWith('
|
|
360
|
+
name.startsWith('SHIPZONE_CI_') && !reservedEnvironmentNames.includes(
|
|
361
361
|
name as (typeof reservedEnvironmentNames)[number],
|
|
362
362
|
)
|
|
363
363
|
) {
|
|
364
|
-
throw new ProtocolError('Step environment uses an unknown reserved
|
|
364
|
+
throw new ProtocolError('Step environment uses an unknown reserved SHIPZONE_CI name');
|
|
365
365
|
}
|
|
366
366
|
if (npmRead && name === npmUserConfigEnvironmentName) {
|
|
367
367
|
throw new ProtocolError(`Step environment may not define the reserved ${name}`);
|
package/ts/runner.ts
CHANGED
|
@@ -45,12 +45,7 @@ import { runnerVersion } from './interfaces.ts';
|
|
|
45
45
|
import { LogSender } from './log-sender.ts';
|
|
46
46
|
import { createRunnerCapabilitySnapshot, RunnerProtocolValidator } from './protocol-validator.ts';
|
|
47
47
|
import { SecretRedactionSet } from './redactor.ts';
|
|
48
|
-
import {
|
|
49
|
-
compareSpecVersions,
|
|
50
|
-
lowerSpecVersion,
|
|
51
|
-
runnerSpecVersion,
|
|
52
|
-
specMajorVersionsMatch,
|
|
53
|
-
} from './spec-version.ts';
|
|
48
|
+
import { runnerSpecVersion, specMajorVersionsMatch } from './spec-version.ts';
|
|
54
49
|
import { scavengeRunnerStaging } from './staging-scavenger.ts';
|
|
55
50
|
|
|
56
51
|
export interface IRunnerCoordinatorClient {
|
|
@@ -209,14 +204,6 @@ class LeaseGuard {
|
|
|
209
204
|
}
|
|
210
205
|
}
|
|
211
206
|
|
|
212
|
-
/**
|
|
213
|
-
* The first specification versions that define the optional capabilities: `resources` from
|
|
214
|
-
* 1.1.0, `leaseFeatures` and `maximumTimeoutMs` from 1.2.0. These are fixed facts of the
|
|
215
|
-
* specification history, not the version this runner implements.
|
|
216
|
-
*/
|
|
217
|
-
const resourceLimitsSpecVersion = '1.1.0';
|
|
218
|
-
const leaseMatchingSpecVersion = '1.2.0';
|
|
219
|
-
|
|
220
207
|
/**
|
|
221
208
|
* The capabilities this runner advertises: the `oci` profile in `container` isolation on the
|
|
222
209
|
* native linux platform of its verified OCI engine, the `none` network mode, the configured
|
|
@@ -271,27 +258,6 @@ export const runnerCapabilities = (
|
|
|
271
258
|
});
|
|
272
259
|
};
|
|
273
260
|
|
|
274
|
-
/**
|
|
275
|
-
* Restricts capabilities to the constructs defined at the lower of the coordinator and runner
|
|
276
|
-
* specification versions, the version every non-job message may use.
|
|
277
|
-
*/
|
|
278
|
-
export const capabilitiesForCoordinator = (
|
|
279
|
-
capabilities: IRunnerCapabilities,
|
|
280
|
-
discovery: Pick<IDiscoveryResponse, 'spec'>,
|
|
281
|
-
): IRunnerCapabilities => {
|
|
282
|
-
const messageSpec = lowerSpecVersion(discovery.spec, runnerSpecVersion);
|
|
283
|
-
const defines = (since: string): boolean => compareSpecVersions(messageSpec, since) >= 0;
|
|
284
|
-
const { resources, leaseFeatures, maximumTimeoutMs, ...defined } = capabilities;
|
|
285
|
-
return createRunnerCapabilitySnapshot({
|
|
286
|
-
...defined,
|
|
287
|
-
...(resources !== undefined && defines(resourceLimitsSpecVersion) ? { resources } : {}),
|
|
288
|
-
...(leaseFeatures !== undefined && defines(leaseMatchingSpecVersion) ? { leaseFeatures } : {}),
|
|
289
|
-
...(maximumTimeoutMs !== undefined && defines(leaseMatchingSpecVersion)
|
|
290
|
-
? { maximumTimeoutMs }
|
|
291
|
-
: {}),
|
|
292
|
-
});
|
|
293
|
-
};
|
|
294
|
-
|
|
295
261
|
export const reconcileProtocolLimits = (
|
|
296
262
|
config: IRunnerConfig,
|
|
297
263
|
discovery: IDiscoveryResponse,
|
|
@@ -356,10 +322,7 @@ export class ShipRunner {
|
|
|
356
322
|
|
|
357
323
|
const runtime = await this.dependencies.executor.verifyRuntime();
|
|
358
324
|
const discovery = await this.dependencies.api.discover(options.signal);
|
|
359
|
-
const capabilities =
|
|
360
|
-
runnerCapabilities(this.config, runtime),
|
|
361
|
-
discovery,
|
|
362
|
-
);
|
|
325
|
+
const capabilities = runnerCapabilities(this.config, runtime);
|
|
363
326
|
reconcileProtocolLimits(this.config, discovery, capabilities);
|
|
364
327
|
const validator = new RunnerProtocolValidator(capabilities);
|
|
365
328
|
const session = await this.dependencies.api.startSession({
|
package/ts/spec-version.ts
CHANGED
|
@@ -53,14 +53,3 @@ export const acceptSpecVersion = (implemented: string, declared: unknown): TSpec
|
|
|
53
53
|
export const specMajorVersionsMatch = (left: string, right: string): boolean =>
|
|
54
54
|
requireCanonical(left, 'Specification version').major ===
|
|
55
55
|
requireCanonical(right, 'Specification version').major;
|
|
56
|
-
|
|
57
|
-
/** Compares two canonical specification versions numerically. */
|
|
58
|
-
export const compareSpecVersions = (left: string, right: string): number =>
|
|
59
|
-
compareParts(
|
|
60
|
-
requireCanonical(left, 'Specification version'),
|
|
61
|
-
requireCanonical(right, 'Specification version'),
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
/** The lower of two canonical versions: the version whose constructs a message may use. */
|
|
65
|
-
export const lowerSpecVersion = (left: string, right: string): string =>
|
|
66
|
-
compareSpecVersions(left, right) <= 0 ? left : right;
|
package/ts/wire-schema.ts
CHANGED
|
@@ -39,12 +39,13 @@ export const isWireSchemaName = (value: unknown): value is TWireSchemaName =>
|
|
|
39
39
|
typeof value === 'string' && (wireSchemaNames as readonly string[]).includes(value);
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* The
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* The document identifiers of the runner protocol (Document Identifiers): the compiled job schema
|
|
43
|
+
* carries its identifier as `$id`, and the OpenAPI components are registered under the
|
|
44
|
+
* description's identifier, against which its `../schemas/runner-job.schema.json` references
|
|
45
|
+
* resolve to that `$id`.
|
|
45
46
|
*/
|
|
46
|
-
const openApiSchemaId = 'https://
|
|
47
|
-
const
|
|
47
|
+
const openApiSchemaId = 'https://ship.zone/spec/ci/spec/runner.openapi.json';
|
|
48
|
+
const runnerJobSchemaId = 'https://ship.zone/spec/ci/schemas/runner-job.schema.json';
|
|
48
49
|
|
|
49
50
|
const rewriteComponentReferences = (value: unknown): unknown => {
|
|
50
51
|
if (Array.isArray(value)) return value.map(rewriteComponentReferences);
|
|
@@ -73,7 +74,7 @@ const componentSchemas = (): unknown => {
|
|
|
73
74
|
|
|
74
75
|
const ajv = new plugins.Ajv2020({ allErrors: true, strict: true });
|
|
75
76
|
ajv.addFormat('date-time', { type: 'string', validate: isProtocolTimestamp });
|
|
76
|
-
ajv.addSchema(plugins.runnerJobSchema
|
|
77
|
+
ajv.addSchema(plugins.runnerJobSchema);
|
|
77
78
|
ajv.addSchema({
|
|
78
79
|
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
79
80
|
$id: openApiSchemaId,
|
|
@@ -134,4 +135,4 @@ export const validateWireMessage = <T>(name: TWireSchemaName, value: unknown): T
|
|
|
134
135
|
|
|
135
136
|
/** Validates a compiled runner job against the published runner job schema. */
|
|
136
137
|
export const validateCompiledJobSchema = <T>(value: unknown): T =>
|
|
137
|
-
assertValid<T>(validatorFor(
|
|
138
|
+
assertValid<T>(validatorFor(runnerJobSchemaId), value, 'Compiled runner job');
|