@ship.zone/runner 3.0.0 → 5.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/.smartconfig.json +19 -1
- package/changelog.md +61 -0
- package/dist_rust/runnerworkspace_linux_amd64_musl +0 -0
- package/dist_rust/runnerworkspace_linux_amd64_musl.tsrust-build.json +4 -4
- package/dist_rust/runnerworkspace_linux_arm64_musl +0 -0
- package/dist_rust/runnerworkspace_linux_arm64_musl.tsrust-build.json +4 -4
- package/dist_ts/00_commitinfo_data.js +3 -3
- package/dist_ts/api-client.d.ts +2 -1
- package/dist_ts/api-client.js +10 -2
- package/dist_ts/artifact-manager.js +1 -1
- package/dist_ts/attempt-state.js +1 -1
- package/dist_ts/cache-manager.js +1 -1
- package/dist_ts/cli-entry.js +17 -3
- package/dist_ts/cli.d.ts +7 -0
- package/dist_ts/cli.js +155 -35
- package/dist_ts/config.js +75 -22
- package/dist_ts/egress-proxy.d.ts +99 -0
- package/dist_ts/egress-proxy.js +607 -0
- package/dist_ts/errors.js +1 -1
- package/dist_ts/filesystem.js +1 -1
- package/dist_ts/index.d.ts +5 -1
- package/dist_ts/index.js +6 -2
- package/dist_ts/interfaces.d.ts +85 -31
- package/dist_ts/interfaces.js +1 -1
- package/dist_ts/log-sender.js +1 -1
- package/dist_ts/microvm-executor.d.ts +90 -0
- package/dist_ts/microvm-executor.js +1078 -0
- package/dist_ts/node-version.d.ts +11 -0
- package/dist_ts/node-version.js +43 -0
- package/dist_ts/npm-grants.d.ts +9 -0
- package/dist_ts/npm-grants.js +44 -0
- package/dist_ts/oci-registry.d.ts +73 -0
- package/dist_ts/oci-registry.js +508 -0
- package/dist_ts/plugins.d.ts +6 -2
- package/dist_ts/plugins.js +7 -3
- package/dist_ts/protocol-validator.d.ts +3 -5
- package/dist_ts/protocol-validator.js +27 -51
- package/dist_ts/redactor.js +1 -1
- package/dist_ts/registration-state.js +1 -1
- package/dist_ts/runner.d.ts +5 -5
- package/dist_ts/runner.js +47 -22
- package/dist_ts/source-workspace.js +1 -1
- package/dist_ts/spec-version.js +1 -1
- package/dist_ts/staging-scavenger.js +1 -1
- package/dist_ts/state-owner.js +4 -2
- package/dist_ts/transfer-archive.js +1 -1
- package/dist_ts/validation.js +1 -1
- package/dist_ts/vsock-protocol.d.ts +130 -0
- package/dist_ts/vsock-protocol.js +336 -0
- package/dist_ts/wire-schema.js +1 -1
- package/package.json +19 -15
- package/readme.md +106 -108
- package/rust/Cargo.lock +1 -0
- package/rust/Cargo.toml +2 -1
- package/rust/src/cpio.rs +147 -0
- package/rust/src/extfs.rs +747 -0
- package/rust/src/guest.rs +2411 -0
- package/rust/src/lib.rs +41 -0
- package/rust/src/main.rs +6 -1
- package/rust/src/oci_tar.rs +842 -0
- package/ts/00_commitinfo_data.ts +2 -2
- package/ts/api-client.ts +19 -1
- package/ts/cli-entry.ts +15 -2
- package/ts/cli.ts +172 -40
- package/ts/config.ts +100 -25
- package/ts/egress-proxy.ts +649 -0
- package/ts/index.ts +5 -1
- package/ts/interfaces.ts +97 -30
- package/ts/microvm-executor.ts +1310 -0
- package/ts/node-version.ts +49 -0
- package/ts/npm-grants.ts +49 -0
- package/ts/oci-registry.ts +649 -0
- package/ts/plugins.ts +6 -2
- package/ts/protocol-validator.ts +29 -58
- package/ts/runner.ts +48 -21
- package/ts/state-owner.ts +8 -1
- package/ts/vsock-protocol.ts +437 -0
- package/dist_ts/oci-executor.d.ts +0 -155
- package/dist_ts/oci-executor.js +0 -2238
- package/ts/oci-executor.ts +0 -2989
package/ts/interfaces.ts
CHANGED
|
@@ -3,12 +3,8 @@ import { commitinfo } from './00_commitinfo_data.js';
|
|
|
3
3
|
export const runnerVersion: string = commitinfo.version;
|
|
4
4
|
|
|
5
5
|
export type TExecutionProfile = 'oci' | 'oci-image' | 'vm';
|
|
6
|
-
export type TIsolation = 'container' | 'microvm';
|
|
7
6
|
export type TRunnerFeature = 'source.tar-gz' | 'artifacts' | 'caches';
|
|
8
|
-
export type TLeaseFeature = 'image-pull-grants' | 'candidate-bindings' | 'npm-read-grants';
|
|
9
7
|
export type TNetworkMode = 'none' | 'egress';
|
|
10
|
-
export type TSourceFormat = 'tar.gz';
|
|
11
|
-
export type TOciRuntime = 'docker' | 'podman';
|
|
12
8
|
export type TArtifactPermission = 'none' | 'write';
|
|
13
9
|
export type TCachePermission = 'none' | 'read' | 'read-write';
|
|
14
10
|
export type TImagePermission = 'none' | 'push';
|
|
@@ -83,17 +79,13 @@ export interface IResourceLimits {
|
|
|
83
79
|
|
|
84
80
|
export interface IRunnerCapabilities {
|
|
85
81
|
executionProfiles: TExecutionProfile[];
|
|
86
|
-
isolation: TIsolation[];
|
|
87
82
|
platforms: string[];
|
|
88
83
|
labels: string[];
|
|
89
84
|
features: TRunnerFeature[];
|
|
90
85
|
networks: TNetworkMode[];
|
|
91
|
-
sourceFormats: TSourceFormat[];
|
|
92
86
|
limits: ITransferLimits;
|
|
93
87
|
/** The largest resource ceilings the runner enforces per attempt. */
|
|
94
88
|
resources?: IResourceLimits;
|
|
95
|
-
/** The lease contents the runner uses. */
|
|
96
|
-
leaseFeatures?: TLeaseFeature[];
|
|
97
89
|
/** The largest job `timeoutMs` the runner executes. */
|
|
98
90
|
maximumTimeoutMs?: number;
|
|
99
91
|
}
|
|
@@ -143,7 +135,6 @@ export interface IClaimJobRequest {
|
|
|
143
135
|
claimRequestId: string;
|
|
144
136
|
runnerId: string;
|
|
145
137
|
sessionId: string;
|
|
146
|
-
capabilities: IRunnerCapabilities;
|
|
147
138
|
}
|
|
148
139
|
|
|
149
140
|
export interface IClaimJobResponse {
|
|
@@ -192,13 +183,11 @@ export interface IJobLease {
|
|
|
192
183
|
}
|
|
193
184
|
|
|
194
185
|
/**
|
|
195
|
-
* A lease this runner executes
|
|
196
|
-
*
|
|
186
|
+
* A lease this runner executes in Firecracker `microvm` isolation (`oci`, `vm`, or `oci-image`),
|
|
187
|
+
* including optional attempt-scoped image grants, candidate bindings, and npm read grants.
|
|
197
188
|
*/
|
|
198
|
-
export interface IOciJobLease extends Omit<IJobLease, 'job'
|
|
199
|
-
job:
|
|
200
|
-
grants: [];
|
|
201
|
-
bindings: [];
|
|
189
|
+
export interface IOciJobLease extends Omit<IJobLease, 'job'> {
|
|
190
|
+
job: TExecutableRunnerJob;
|
|
202
191
|
}
|
|
203
192
|
|
|
204
193
|
export interface IJobIdentity {
|
|
@@ -278,6 +267,32 @@ export interface IRecoverAttemptRequest {
|
|
|
278
267
|
reason: 'runner_restarted';
|
|
279
268
|
}
|
|
280
269
|
|
|
270
|
+
export interface IRecordImageRequest {
|
|
271
|
+
recordRequestId: string;
|
|
272
|
+
identity: IJobIdentity;
|
|
273
|
+
manifestDigest: string;
|
|
274
|
+
mediaType: 'application/vnd.oci.image.manifest.v1+json';
|
|
275
|
+
sizeBytes: number;
|
|
276
|
+
platform: string;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export interface IImageRecord {
|
|
280
|
+
registry: string;
|
|
281
|
+
repository: string;
|
|
282
|
+
manifestDigest: string;
|
|
283
|
+
mediaType: 'application/vnd.oci.image.manifest.v1+json';
|
|
284
|
+
sizeBytes: number;
|
|
285
|
+
platform: string;
|
|
286
|
+
createdAt: string;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export interface IProducedImageManifest {
|
|
290
|
+
readonly manifestDigest: string;
|
|
291
|
+
readonly mediaType: 'application/vnd.oci.image.manifest.v1+json';
|
|
292
|
+
readonly sizeBytes: number;
|
|
293
|
+
readonly platform: string;
|
|
294
|
+
}
|
|
295
|
+
|
|
281
296
|
export interface ITransferRecord {
|
|
282
297
|
name: string;
|
|
283
298
|
format: 'tar.gz';
|
|
@@ -297,7 +312,6 @@ export interface IErrorResponse {
|
|
|
297
312
|
|
|
298
313
|
export interface IJobRequirements {
|
|
299
314
|
executionProfile: TExecutionProfile;
|
|
300
|
-
isolation: TIsolation;
|
|
301
315
|
platform?: string;
|
|
302
316
|
labels: string[];
|
|
303
317
|
features: TRunnerFeature[];
|
|
@@ -456,13 +470,30 @@ export interface IImageBuildRunnerJob extends ICompiledRunnerJobBase {
|
|
|
456
470
|
/** Every compiled job shape the published runner job schema admits. */
|
|
457
471
|
export type TCompiledRunnerJob = IContainerRunnerJob | IVmRunnerJob | IImageBuildRunnerJob;
|
|
458
472
|
|
|
459
|
-
/** An `oci` job this runner executes
|
|
473
|
+
/** An `oci` job this runner executes in a Firecracker microVM. */
|
|
460
474
|
export interface IOciRunnerJob extends IContainerRunnerJob {
|
|
461
|
-
requirements: IJobRequirements & { executionProfile: 'oci'
|
|
462
|
-
|
|
463
|
-
|
|
475
|
+
requirements: IJobRequirements & { executionProfile: 'oci' };
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/** A `vm` job this runner executes in a Firecracker microVM. */
|
|
479
|
+
export interface IVmExecutableRunnerJob extends IVmRunnerJob {
|
|
480
|
+
requirements: IJobRequirements & { executionProfile: 'vm'; platform: string };
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/** An `oci-image` job this runner executes in a Firecracker microVM. */
|
|
484
|
+
export interface IImageBuildExecutableRunnerJob extends IImageBuildRunnerJob {
|
|
485
|
+
requirements: IJobRequirements & {
|
|
486
|
+
executionProfile: 'oci-image';
|
|
487
|
+
platform: string;
|
|
488
|
+
};
|
|
464
489
|
}
|
|
465
490
|
|
|
491
|
+
/** Every compiled job shape this unified Firecracker runner executes. */
|
|
492
|
+
export type TExecutableRunnerJob =
|
|
493
|
+
| IOciRunnerJob
|
|
494
|
+
| IVmExecutableRunnerJob
|
|
495
|
+
| IImageBuildExecutableRunnerJob;
|
|
496
|
+
|
|
466
497
|
export interface ITransferMetadata {
|
|
467
498
|
sha256: string;
|
|
468
499
|
sizeBytes: number;
|
|
@@ -519,10 +550,29 @@ export type TOciArchitecture = 'amd64' | 'arm64';
|
|
|
519
550
|
export type TOciHelperTarget = 'linux_amd64' | 'linux_arm64';
|
|
520
551
|
|
|
521
552
|
export interface IOciExecutorConfig {
|
|
522
|
-
|
|
523
|
-
|
|
553
|
+
/** Pinned Linux vmlinux kernel path for Firecracker microVMs. */
|
|
554
|
+
kernelPath: string;
|
|
555
|
+
/** Optional pinned ext2 guest rootfs containing rootless BuildKit (`buildkitd` + `buildctl`) for `oci-image` jobs. */
|
|
556
|
+
builderRootfsPath?: string;
|
|
557
|
+
/** Optional digest-pinned OCI image containing rootless BuildKit (pulled on demand when `builderRootfsPath` is not set). */
|
|
558
|
+
builderImage?: string;
|
|
559
|
+
/** Optional override for the `buildctl` binary path inside the builder guest. */
|
|
560
|
+
buildctlPath?: string;
|
|
561
|
+
/** Optional smartvm-helper Unix socket path (defaults to `/run/smartvm/helper.sock`). */
|
|
562
|
+
smartvmSocketPath?: string;
|
|
563
|
+
/** Optional smartvm-bridge runtime directory for vsock relay sockets. */
|
|
564
|
+
smartvmRuntimeDir?: string;
|
|
565
|
+
/** Optional explicit path to the smartvm-bridge binary. */
|
|
566
|
+
smartvmBridgePath?: string;
|
|
567
|
+
/** Kernel boot arguments passed to Firecracker. */
|
|
568
|
+
bootArgs: string;
|
|
569
|
+
/** Maximum extracted OCI rootfs image bytes accepted during image materialization. */
|
|
570
|
+
maximumRootfsBytes: number;
|
|
571
|
+
/** Guest memory headroom reserved for the guest kernel and init agent on top of step memory. */
|
|
572
|
+
guestMemoryOverheadBytes: number;
|
|
573
|
+
/** Extra internal CIDRs blocked by the host egress proxy (e.g. coordinator network ranges). */
|
|
574
|
+
egressBlockedCidrs: string[];
|
|
524
575
|
workspaceHelperPath?: string;
|
|
525
|
-
requireRootless: boolean;
|
|
526
576
|
allowedNetworks: TNetworkMode[];
|
|
527
577
|
containerUser: string;
|
|
528
578
|
defaultTimeoutMs: number;
|
|
@@ -583,16 +633,24 @@ export interface IExecutionContext {
|
|
|
583
633
|
onLog: (stream: 'stdout' | 'stderr', data: string) => Promise<void>;
|
|
584
634
|
}
|
|
585
635
|
|
|
636
|
+
export interface IMicroVmShapeInfo {
|
|
637
|
+
readonly id: string;
|
|
638
|
+
readonly vcpus: number;
|
|
639
|
+
readonly memMib: number;
|
|
640
|
+
}
|
|
641
|
+
|
|
586
642
|
export interface IOciRuntimeFacts {
|
|
587
|
-
readonly
|
|
643
|
+
readonly engine: 'firecracker';
|
|
644
|
+
readonly firecrackerVersion: string;
|
|
588
645
|
readonly endpoint: string;
|
|
589
|
-
readonly rootless: boolean;
|
|
590
646
|
readonly os: 'linux';
|
|
591
647
|
readonly architecture: TOciArchitecture;
|
|
592
648
|
readonly helperTarget: TOciHelperTarget;
|
|
593
649
|
readonly helperPath: string;
|
|
594
650
|
readonly helperSha256: string;
|
|
595
|
-
readonly
|
|
651
|
+
readonly initrdPath: string;
|
|
652
|
+
readonly kernelPath: string;
|
|
653
|
+
readonly shapes: readonly IMicroVmShapeInfo[];
|
|
596
654
|
}
|
|
597
655
|
|
|
598
656
|
export interface IPrepareOciLeaseContext {
|
|
@@ -607,6 +665,11 @@ export interface IPreparedOciLease {
|
|
|
607
665
|
readonly attemptId: string;
|
|
608
666
|
readonly image: string;
|
|
609
667
|
readonly imageArchitecture: TOciArchitecture;
|
|
668
|
+
readonly rootfsPath?: string;
|
|
669
|
+
readonly imageDigest?: string;
|
|
670
|
+
readonly shapeId?: string;
|
|
671
|
+
readonly defaultEnv?: Record<string, string>;
|
|
672
|
+
readonly defaultWorkingDir?: string;
|
|
610
673
|
cleanup(): Promise<void>;
|
|
611
674
|
}
|
|
612
675
|
|
|
@@ -636,6 +699,7 @@ export interface IRuntimeWorkspaceExporter {
|
|
|
636
699
|
export interface IExecutionResult {
|
|
637
700
|
exitCode: number | null;
|
|
638
701
|
stopReason?: TExecutionStopReason;
|
|
702
|
+
producedImage?: IProducedImageManifest;
|
|
639
703
|
workspace?: IRuntimeWorkspaceExporter;
|
|
640
704
|
}
|
|
641
705
|
|
|
@@ -655,7 +719,7 @@ export interface IPreparedWorkspace {
|
|
|
655
719
|
|
|
656
720
|
export interface ISourcePrepareContext {
|
|
657
721
|
identity: IJobIdentity;
|
|
658
|
-
job: Pick<
|
|
722
|
+
job: Pick<TExecutableRunnerJob, 'source' | 'permissions' | 'requirements'>;
|
|
659
723
|
signal: AbortSignal;
|
|
660
724
|
}
|
|
661
725
|
|
|
@@ -679,7 +743,7 @@ export interface ISecretRedactionSet {
|
|
|
679
743
|
|
|
680
744
|
export interface IArtifactUploadContext {
|
|
681
745
|
workspace: IRuntimeWorkspaceExporter;
|
|
682
|
-
job: Pick<IOciRunnerJob, 'artifacts' | 'permissions' | 'requirements'>;
|
|
746
|
+
job: Pick<IOciRunnerJob | IVmExecutableRunnerJob, 'artifacts' | 'permissions' | 'requirements'>;
|
|
683
747
|
status: TJobCompletionStatus;
|
|
684
748
|
redactionSet: ISecretRedactionSet;
|
|
685
749
|
identity: IJobIdentity;
|
|
@@ -693,14 +757,17 @@ export interface IArtifactManager {
|
|
|
693
757
|
export interface ICacheRestoreContext {
|
|
694
758
|
workspacePath: string;
|
|
695
759
|
workspaceEntryCount: number;
|
|
696
|
-
job: Pick<
|
|
760
|
+
job: Pick<
|
|
761
|
+
IOciRunnerJob | IVmExecutableRunnerJob,
|
|
762
|
+
'caches' | 'permissions' | 'requirements' | 'source'
|
|
763
|
+
>;
|
|
697
764
|
identity: IJobIdentity;
|
|
698
765
|
signal: AbortSignal;
|
|
699
766
|
}
|
|
700
767
|
|
|
701
768
|
export interface ICacheSaveContext {
|
|
702
769
|
workspace: IRuntimeWorkspaceExporter;
|
|
703
|
-
job: Pick<IOciRunnerJob, 'caches' | 'permissions' | 'requirements'>;
|
|
770
|
+
job: Pick<IOciRunnerJob | IVmExecutableRunnerJob, 'caches' | 'permissions' | 'requirements'>;
|
|
704
771
|
status: TJobCompletionStatus;
|
|
705
772
|
redactionSet: ISecretRedactionSet;
|
|
706
773
|
identity: IJobIdentity;
|