@lakutata/containerd 0.0.0-stage → 3.0.0-beta.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/LICENSE +23 -0
- package/README.md +409 -2
- package/THIRD_PARTY_NOTICES.md +310 -0
- package/dist/cjs/client/BuildKit.d.ts +176 -0
- package/dist/cjs/client/BuildKit.js +536 -0
- package/dist/cjs/client/BuildKitMessages.d.ts +35 -0
- package/dist/cjs/client/BuildKitMessages.js +123 -0
- package/dist/cjs/client/ContainerStore.d.ts +558 -0
- package/dist/cjs/client/ContainerStore.js +1384 -0
- package/dist/cjs/client/ContainerdClient.d.ts +244 -0
- package/dist/cjs/client/ContainerdClient.js +455 -0
- package/dist/cjs/client/DockerIgnore.d.ts +44 -0
- package/dist/cjs/client/DockerIgnore.js +186 -0
- package/dist/cjs/client/Fifo.d.ts +31 -0
- package/dist/cjs/client/Fifo.js +66 -0
- package/dist/cjs/client/ImageStore.d.ts +258 -0
- package/dist/cjs/client/ImageStore.js +636 -0
- package/dist/cjs/client/Messages.d.ts +103 -0
- package/dist/cjs/client/Messages.js +397 -0
- package/dist/cjs/client/Networks.d.ts +221 -0
- package/dist/cjs/client/Networks.js +630 -0
- package/dist/cjs/client/Platforms.d.ts +53 -0
- package/dist/cjs/client/Platforms.js +169 -0
- package/dist/cjs/client/Reference.d.ts +33 -0
- package/dist/cjs/client/Reference.js +70 -0
- package/dist/cjs/client/Registry.d.ts +145 -0
- package/dist/cjs/client/Registry.js +272 -0
- package/dist/cjs/client/Rootfs.d.ts +83 -0
- package/dist/cjs/client/Rootfs.js +245 -0
- package/dist/cjs/client/Seccomp.d.ts +36 -0
- package/dist/cjs/client/Seccomp.js +156 -0
- package/dist/cjs/client/Spec.d.ts +151 -0
- package/dist/cjs/client/Spec.js +227 -0
- package/dist/cjs/client/Volumes.d.ts +42 -0
- package/dist/cjs/client/Volumes.js +80 -0
- package/dist/cjs/containerd/Containerd.d.ts +442 -0
- package/dist/cjs/containerd/Containerd.js +929 -0
- package/dist/cjs/containerd/exceptions/ContainerdConnectionException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdConnectionException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdContainerNameConflictException.d.ts +8 -0
- package/dist/cjs/containerd/exceptions/ContainerdContainerNameConflictException.js +15 -0
- package/dist/cjs/containerd/exceptions/ContainerdContainerNotFoundException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdContainerNotFoundException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdContainerStateException.d.ts +10 -0
- package/dist/cjs/containerd/exceptions/ContainerdContainerStateException.js +17 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageBuildException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageBuildException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageExportException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageExportException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageImportException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageImportException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageNotFoundException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdImageNotFoundException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdImagePullException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdImagePullException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdImagePushException.d.ts +8 -0
- package/dist/cjs/containerd/exceptions/ContainerdImagePushException.js +15 -0
- package/dist/cjs/containerd/exceptions/ContainerdNetworkConflictException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdNetworkConflictException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdNetworkNotFoundException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdNetworkNotFoundException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdPathNotFoundException.d.ts +8 -0
- package/dist/cjs/containerd/exceptions/ContainerdPathNotFoundException.js +15 -0
- package/dist/cjs/containerd/exceptions/ContainerdPlatformException.d.ts +9 -0
- package/dist/cjs/containerd/exceptions/ContainerdPlatformException.js +16 -0
- package/dist/cjs/containerd/exceptions/ContainerdVolumeInUseException.d.ts +8 -0
- package/dist/cjs/containerd/exceptions/ContainerdVolumeInUseException.js +15 -0
- package/dist/cjs/containerd/exceptions/ContainerdVolumeNotFoundException.d.ts +8 -0
- package/dist/cjs/containerd/exceptions/ContainerdVolumeNotFoundException.js +15 -0
- package/dist/cjs/containerd/lib/ContainerdContainer.d.ts +292 -0
- package/dist/cjs/containerd/lib/ContainerdContainer.js +536 -0
- package/dist/cjs/containerd/lib/ContainerdContainerTTY.d.ts +116 -0
- package/dist/cjs/containerd/lib/ContainerdContainerTTY.js +178 -0
- package/dist/cjs/containerd/lib/ContainerdErrors.d.ts +6 -0
- package/dist/cjs/containerd/lib/ContainerdErrors.js +37 -0
- package/dist/cjs/containerd/lib/ContainerdImage.d.ts +149 -0
- package/dist/cjs/containerd/lib/ContainerdImage.js +222 -0
- package/dist/cjs/containerd/options/ContainerdPruneOptions.d.ts +44 -0
- package/dist/cjs/containerd/options/ContainerdPruneOptions.js +51 -0
- package/dist/cjs/containerd/options/ContainerdRegistryAuthOptions.d.ts +32 -0
- package/dist/cjs/containerd/options/ContainerdRegistryAuthOptions.js +45 -0
- package/dist/cjs/containerd/options/container/ContainerCommitOptions.d.ts +57 -0
- package/dist/cjs/containerd/options/container/ContainerCommitOptions.js +66 -0
- package/dist/cjs/containerd/options/container/ContainerCreateOptions.d.ts +273 -0
- package/dist/cjs/containerd/options/container/ContainerCreateOptions.js +239 -0
- package/dist/cjs/containerd/options/container/ContainerExecOptions.d.ts +53 -0
- package/dist/cjs/containerd/options/container/ContainerExecOptions.js +63 -0
- package/dist/cjs/containerd/options/container/ContainerExportDirectoryOptions.d.ts +32 -0
- package/dist/cjs/containerd/options/container/ContainerExportDirectoryOptions.js +45 -0
- package/dist/cjs/containerd/options/container/ContainerKillOptions.d.ts +30 -0
- package/dist/cjs/containerd/options/container/ContainerKillOptions.js +41 -0
- package/dist/cjs/containerd/options/container/ContainerLogsOptions.d.ts +34 -0
- package/dist/cjs/containerd/options/container/ContainerLogsOptions.js +44 -0
- package/dist/cjs/containerd/options/container/ContainerRemoveOptions.d.ts +22 -0
- package/dist/cjs/containerd/options/container/ContainerRemoveOptions.js +34 -0
- package/dist/cjs/containerd/options/container/ContainerResourceOptions.d.ts +63 -0
- package/dist/cjs/containerd/options/container/ContainerResourceOptions.js +67 -0
- package/dist/cjs/containerd/options/container/ContainerStopOptions.d.ts +30 -0
- package/dist/cjs/containerd/options/container/ContainerStopOptions.js +41 -0
- package/dist/cjs/containerd/options/container/ContainerTTYConsoleSizeOptions.d.ts +26 -0
- package/dist/cjs/containerd/options/container/ContainerTTYConsoleSizeOptions.js +40 -0
- package/dist/cjs/containerd/options/container/ContainerTTYOptions.d.ts +50 -0
- package/dist/cjs/containerd/options/container/ContainerTTYOptions.js +63 -0
- package/dist/cjs/containerd/options/image/ImageBuildOptions.d.ts +88 -0
- package/dist/cjs/containerd/options/image/ImageBuildOptions.js +95 -0
- package/dist/cjs/containerd/options/image/ImageExportOptions.d.ts +25 -0
- package/dist/cjs/containerd/options/image/ImageExportOptions.js +39 -0
- package/dist/cjs/containerd/options/image/ImageImportOptions.d.ts +38 -0
- package/dist/cjs/containerd/options/image/ImageImportOptions.js +47 -0
- package/dist/cjs/containerd/options/image/ImagePullOptions.d.ts +53 -0
- package/dist/cjs/containerd/options/image/ImagePullOptions.js +66 -0
- package/dist/cjs/containerd/options/image/ImagePushOptions.d.ts +44 -0
- package/dist/cjs/containerd/options/image/ImagePushOptions.js +58 -0
- package/dist/cjs/containerd/options/network/NetworkCreateOptions.d.ts +82 -0
- package/dist/cjs/containerd/options/network/NetworkCreateOptions.js +83 -0
- package/dist/cjs/containerd/options/volume/VolumeCreateOptions.d.ts +26 -0
- package/dist/cjs/containerd/options/volume/VolumeCreateOptions.js +40 -0
- package/dist/cjs/containerd/types/ContainerdBind.d.ts +28 -0
- package/dist/cjs/containerd/types/ContainerdBind.js +2 -0
- package/dist/cjs/containerd/types/ContainerdBuildOutputCallback.d.ts +6 -0
- package/dist/cjs/containerd/types/ContainerdBuildOutputCallback.js +2 -0
- package/dist/cjs/containerd/types/ContainerdContainerNetwork.d.ts +40 -0
- package/dist/cjs/containerd/types/ContainerdContainerNetwork.js +2 -0
- package/dist/cjs/containerd/types/ContainerdContainerPort.d.ts +22 -0
- package/dist/cjs/containerd/types/ContainerdContainerPort.js +2 -0
- package/dist/cjs/containerd/types/ContainerdContainerState.d.ts +42 -0
- package/dist/cjs/containerd/types/ContainerdContainerState.js +2 -0
- package/dist/cjs/containerd/types/ContainerdContainerStats.d.ts +107 -0
- package/dist/cjs/containerd/types/ContainerdContainerStats.js +2 -0
- package/dist/cjs/containerd/types/ContainerdDevice.d.ts +25 -0
- package/dist/cjs/containerd/types/ContainerdDevice.js +2 -0
- package/dist/cjs/containerd/types/ContainerdExecResult.d.ts +18 -0
- package/dist/cjs/containerd/types/ContainerdExecResult.js +2 -0
- package/dist/cjs/containerd/types/ContainerdImageConfig.d.ts +46 -0
- package/dist/cjs/containerd/types/ContainerdImageConfig.js +2 -0
- package/dist/cjs/containerd/types/ContainerdNetworkInfo.d.ts +49 -0
- package/dist/cjs/containerd/types/ContainerdNetworkInfo.js +2 -0
- package/dist/cjs/containerd/types/ContainerdProgressCallback.d.ts +29 -0
- package/dist/cjs/containerd/types/ContainerdProgressCallback.js +2 -0
- package/dist/cjs/containerd/types/ContainerdPruneResult.d.ts +21 -0
- package/dist/cjs/containerd/types/ContainerdPruneResult.js +2 -0
- package/dist/cjs/containerd/types/ContainerdRestartPolicy.d.ts +13 -0
- package/dist/cjs/containerd/types/ContainerdRestartPolicy.js +2 -0
- package/dist/cjs/containerd/types/ContainerdTmpfs.d.ts +20 -0
- package/dist/cjs/containerd/types/ContainerdTmpfs.js +2 -0
- package/dist/cjs/containerd/types/ContainerdVolume.d.ts +19 -0
- package/dist/cjs/containerd/types/ContainerdVolume.js +2 -0
- package/dist/cjs/containerd/types/ContainerdVolumeInfo.d.ts +26 -0
- package/dist/cjs/containerd/types/ContainerdVolumeInfo.js +2 -0
- package/dist/cjs/exports/Containerd.d.ts +69 -0
- package/dist/cjs/exports/Containerd.js +87 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/client/BuildKit.js +488 -0
- package/dist/esm/client/BuildKitMessages.js +120 -0
- package/dist/esm/client/ContainerStore.js +1339 -0
- package/dist/esm/client/ContainerdClient.js +416 -0
- package/dist/esm/client/DockerIgnore.js +179 -0
- package/dist/esm/client/Fifo.js +59 -0
- package/dist/esm/client/ImageStore.js +628 -0
- package/dist/esm/client/Messages.js +393 -0
- package/dist/esm/client/Networks.js +621 -0
- package/dist/esm/client/Platforms.js +156 -0
- package/dist/esm/client/Reference.js +66 -0
- package/dist/esm/client/Registry.js +263 -0
- package/dist/esm/client/Rootfs.js +234 -0
- package/dist/esm/client/Seccomp.js +152 -0
- package/dist/esm/client/Spec.js +220 -0
- package/dist/esm/client/Volumes.js +73 -0
- package/dist/esm/containerd/Containerd.js +923 -0
- package/dist/esm/containerd/exceptions/ContainerdConnectionException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdContainerNameConflictException.js +11 -0
- package/dist/esm/containerd/exceptions/ContainerdContainerNotFoundException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdContainerStateException.js +13 -0
- package/dist/esm/containerd/exceptions/ContainerdImageBuildException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdImageExportException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdImageImportException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdImageNotFoundException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdImagePullException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdImagePushException.js +11 -0
- package/dist/esm/containerd/exceptions/ContainerdNetworkConflictException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdNetworkNotFoundException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdPathNotFoundException.js +11 -0
- package/dist/esm/containerd/exceptions/ContainerdPlatformException.js +12 -0
- package/dist/esm/containerd/exceptions/ContainerdVolumeInUseException.js +11 -0
- package/dist/esm/containerd/exceptions/ContainerdVolumeNotFoundException.js +11 -0
- package/dist/esm/containerd/lib/ContainerdContainer.js +533 -0
- package/dist/esm/containerd/lib/ContainerdContainerTTY.js +175 -0
- package/dist/esm/containerd/lib/ContainerdErrors.js +34 -0
- package/dist/esm/containerd/lib/ContainerdImage.js +219 -0
- package/dist/esm/containerd/options/ContainerdPruneOptions.js +47 -0
- package/dist/esm/containerd/options/ContainerdRegistryAuthOptions.js +41 -0
- package/dist/esm/containerd/options/container/ContainerCommitOptions.js +62 -0
- package/dist/esm/containerd/options/container/ContainerCreateOptions.js +235 -0
- package/dist/esm/containerd/options/container/ContainerExecOptions.js +59 -0
- package/dist/esm/containerd/options/container/ContainerExportDirectoryOptions.js +41 -0
- package/dist/esm/containerd/options/container/ContainerKillOptions.js +37 -0
- package/dist/esm/containerd/options/container/ContainerLogsOptions.js +40 -0
- package/dist/esm/containerd/options/container/ContainerRemoveOptions.js +30 -0
- package/dist/esm/containerd/options/container/ContainerResourceOptions.js +63 -0
- package/dist/esm/containerd/options/container/ContainerStopOptions.js +37 -0
- package/dist/esm/containerd/options/container/ContainerTTYConsoleSizeOptions.js +36 -0
- package/dist/esm/containerd/options/container/ContainerTTYOptions.js +59 -0
- package/dist/esm/containerd/options/image/ImageBuildOptions.js +91 -0
- package/dist/esm/containerd/options/image/ImageExportOptions.js +35 -0
- package/dist/esm/containerd/options/image/ImageImportOptions.js +43 -0
- package/dist/esm/containerd/options/image/ImagePullOptions.js +62 -0
- package/dist/esm/containerd/options/image/ImagePushOptions.js +54 -0
- package/dist/esm/containerd/options/network/NetworkCreateOptions.js +79 -0
- package/dist/esm/containerd/options/volume/VolumeCreateOptions.js +36 -0
- package/dist/esm/containerd/types/ContainerdBind.js +1 -0
- package/dist/esm/containerd/types/ContainerdBuildOutputCallback.js +1 -0
- package/dist/esm/containerd/types/ContainerdContainerNetwork.js +1 -0
- package/dist/esm/containerd/types/ContainerdContainerPort.js +1 -0
- package/dist/esm/containerd/types/ContainerdContainerState.js +1 -0
- package/dist/esm/containerd/types/ContainerdContainerStats.js +1 -0
- package/dist/esm/containerd/types/ContainerdDevice.js +1 -0
- package/dist/esm/containerd/types/ContainerdExecResult.js +1 -0
- package/dist/esm/containerd/types/ContainerdImageConfig.js +1 -0
- package/dist/esm/containerd/types/ContainerdNetworkInfo.js +1 -0
- package/dist/esm/containerd/types/ContainerdProgressCallback.js +1 -0
- package/dist/esm/containerd/types/ContainerdPruneResult.js +1 -0
- package/dist/esm/containerd/types/ContainerdRestartPolicy.js +1 -0
- package/dist/esm/containerd/types/ContainerdTmpfs.js +1 -0
- package/dist/esm/containerd/types/ContainerdVolume.js +1 -0
- package/dist/esm/containerd/types/ContainerdVolumeInfo.js +1 -0
- package/dist/esm/exports/Containerd.js +68 -0
- package/dist/types/client/BuildKit.d.ts +176 -0
- package/dist/types/client/BuildKitMessages.d.ts +35 -0
- package/dist/types/client/ContainerStore.d.ts +558 -0
- package/dist/types/client/ContainerdClient.d.ts +244 -0
- package/dist/types/client/DockerIgnore.d.ts +44 -0
- package/dist/types/client/Fifo.d.ts +31 -0
- package/dist/types/client/ImageStore.d.ts +258 -0
- package/dist/types/client/Messages.d.ts +103 -0
- package/dist/types/client/Networks.d.ts +221 -0
- package/dist/types/client/Platforms.d.ts +53 -0
- package/dist/types/client/Reference.d.ts +33 -0
- package/dist/types/client/Registry.d.ts +145 -0
- package/dist/types/client/Rootfs.d.ts +83 -0
- package/dist/types/client/Seccomp.d.ts +36 -0
- package/dist/types/client/Spec.d.ts +151 -0
- package/dist/types/client/Volumes.d.ts +42 -0
- package/dist/types/containerd/Containerd.d.ts +442 -0
- package/dist/types/containerd/exceptions/ContainerdConnectionException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdContainerNameConflictException.d.ts +8 -0
- package/dist/types/containerd/exceptions/ContainerdContainerNotFoundException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdContainerStateException.d.ts +10 -0
- package/dist/types/containerd/exceptions/ContainerdImageBuildException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdImageExportException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdImageImportException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdImageNotFoundException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdImagePullException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdImagePushException.d.ts +8 -0
- package/dist/types/containerd/exceptions/ContainerdNetworkConflictException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdNetworkNotFoundException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdPathNotFoundException.d.ts +8 -0
- package/dist/types/containerd/exceptions/ContainerdPlatformException.d.ts +9 -0
- package/dist/types/containerd/exceptions/ContainerdVolumeInUseException.d.ts +8 -0
- package/dist/types/containerd/exceptions/ContainerdVolumeNotFoundException.d.ts +8 -0
- package/dist/types/containerd/lib/ContainerdContainer.d.ts +292 -0
- package/dist/types/containerd/lib/ContainerdContainerTTY.d.ts +116 -0
- package/dist/types/containerd/lib/ContainerdErrors.d.ts +6 -0
- package/dist/types/containerd/lib/ContainerdImage.d.ts +149 -0
- package/dist/types/containerd/options/ContainerdPruneOptions.d.ts +44 -0
- package/dist/types/containerd/options/ContainerdRegistryAuthOptions.d.ts +32 -0
- package/dist/types/containerd/options/container/ContainerCommitOptions.d.ts +57 -0
- package/dist/types/containerd/options/container/ContainerCreateOptions.d.ts +273 -0
- package/dist/types/containerd/options/container/ContainerExecOptions.d.ts +53 -0
- package/dist/types/containerd/options/container/ContainerExportDirectoryOptions.d.ts +32 -0
- package/dist/types/containerd/options/container/ContainerKillOptions.d.ts +30 -0
- package/dist/types/containerd/options/container/ContainerLogsOptions.d.ts +34 -0
- package/dist/types/containerd/options/container/ContainerRemoveOptions.d.ts +22 -0
- package/dist/types/containerd/options/container/ContainerResourceOptions.d.ts +63 -0
- package/dist/types/containerd/options/container/ContainerStopOptions.d.ts +30 -0
- package/dist/types/containerd/options/container/ContainerTTYConsoleSizeOptions.d.ts +26 -0
- package/dist/types/containerd/options/container/ContainerTTYOptions.d.ts +50 -0
- package/dist/types/containerd/options/image/ImageBuildOptions.d.ts +88 -0
- package/dist/types/containerd/options/image/ImageExportOptions.d.ts +25 -0
- package/dist/types/containerd/options/image/ImageImportOptions.d.ts +38 -0
- package/dist/types/containerd/options/image/ImagePullOptions.d.ts +53 -0
- package/dist/types/containerd/options/image/ImagePushOptions.d.ts +44 -0
- package/dist/types/containerd/options/network/NetworkCreateOptions.d.ts +82 -0
- package/dist/types/containerd/options/volume/VolumeCreateOptions.d.ts +26 -0
- package/dist/types/containerd/types/ContainerdBind.d.ts +28 -0
- package/dist/types/containerd/types/ContainerdBuildOutputCallback.d.ts +6 -0
- package/dist/types/containerd/types/ContainerdContainerNetwork.d.ts +40 -0
- package/dist/types/containerd/types/ContainerdContainerPort.d.ts +22 -0
- package/dist/types/containerd/types/ContainerdContainerState.d.ts +42 -0
- package/dist/types/containerd/types/ContainerdContainerStats.d.ts +107 -0
- package/dist/types/containerd/types/ContainerdDevice.d.ts +25 -0
- package/dist/types/containerd/types/ContainerdExecResult.d.ts +18 -0
- package/dist/types/containerd/types/ContainerdImageConfig.d.ts +46 -0
- package/dist/types/containerd/types/ContainerdNetworkInfo.d.ts +49 -0
- package/dist/types/containerd/types/ContainerdProgressCallback.d.ts +29 -0
- package/dist/types/containerd/types/ContainerdPruneResult.d.ts +21 -0
- package/dist/types/containerd/types/ContainerdRestartPolicy.d.ts +13 -0
- package/dist/types/containerd/types/ContainerdTmpfs.d.ts +20 -0
- package/dist/types/containerd/types/ContainerdVolume.d.ts +19 -0
- package/dist/types/containerd/types/ContainerdVolumeInfo.d.ts +26 -0
- package/dist/types/exports/Containerd.d.ts +69 -0
- package/package.json +51 -4
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.BuildKitProgress = exports.BuildKitSession = void 0;
|
|
40
|
+
exports.goFileMode = goFileMode;
|
|
41
|
+
exports.patternExpression = patternExpression;
|
|
42
|
+
exports.walkDirectory = walkDirectory;
|
|
43
|
+
exports.sendDirectory = sendDirectory;
|
|
44
|
+
exports.buildKitBuild = buildKitBuild;
|
|
45
|
+
exports.buildKitVersion = buildKitVersion;
|
|
46
|
+
exports.buildKitPlatforms = buildKitPlatforms;
|
|
47
|
+
const node_crypto_1 = require("node:crypto");
|
|
48
|
+
const node_fs_1 = require("node:fs");
|
|
49
|
+
const promises_1 = require("node:fs/promises");
|
|
50
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
51
|
+
const node_stream_1 = require("node:stream");
|
|
52
|
+
const promises_2 = require("node:stream/promises");
|
|
53
|
+
const grpc_1 = require("@lakutata/grpc");
|
|
54
|
+
const B = __importStar(require("./BuildKitMessages.js"));
|
|
55
|
+
const DockerIgnore_js_1 = require("./DockerIgnore.js");
|
|
56
|
+
const Platforms_js_1 = require("./Platforms.js");
|
|
57
|
+
const Registry_js_1 = require("./Registry.js");
|
|
58
|
+
const ContainerdClient_js_1 = require("./ContainerdClient.js");
|
|
59
|
+
/**
|
|
60
|
+
* The service of BuildKit
|
|
61
|
+
*/
|
|
62
|
+
const CONTROL = '/moby.buildkit.v1.Control';
|
|
63
|
+
/**
|
|
64
|
+
* The size of the chunks of the files sent
|
|
65
|
+
*/
|
|
66
|
+
const CHUNK_SIZE = 32 * 1024;
|
|
67
|
+
/**
|
|
68
|
+
* The mode of a file as Go writes it (os.FileMode), the one of the stats of fsutil
|
|
69
|
+
* @param stats
|
|
70
|
+
*/
|
|
71
|
+
function goFileMode(stats) {
|
|
72
|
+
let mode = Number(stats.mode & 511n);
|
|
73
|
+
if (stats.isDirectory())
|
|
74
|
+
mode |= 0x80000000;
|
|
75
|
+
else if (stats.isSymbolicLink())
|
|
76
|
+
mode |= 0x08000000;
|
|
77
|
+
else if (stats.isFIFO())
|
|
78
|
+
mode |= 0x02000000;
|
|
79
|
+
else if (stats.isSocket())
|
|
80
|
+
mode |= 0x01000000;
|
|
81
|
+
else if (stats.isCharacterDevice())
|
|
82
|
+
mode |= 0x04000000 | 0x00200000;
|
|
83
|
+
else if (stats.isBlockDevice())
|
|
84
|
+
mode |= 0x04000000;
|
|
85
|
+
if (stats.mode & 2048n)
|
|
86
|
+
mode |= 0x00800000;
|
|
87
|
+
if (stats.mode & 1024n)
|
|
88
|
+
mode |= 0x00400000;
|
|
89
|
+
if (stats.mode & 512n)
|
|
90
|
+
mode |= 0x00100000;
|
|
91
|
+
return mode >>> 0;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The expression of a pattern of the paths of fsutil (filepath.Match, ** for any directories)
|
|
95
|
+
* @param pattern
|
|
96
|
+
*/
|
|
97
|
+
function patternExpression(pattern) {
|
|
98
|
+
const normalized = node_path_1.default.posix.normalize(pattern.replace(/\\/g, '/')).replace(/^\/+/, '').replace(/\/+$/, '');
|
|
99
|
+
let expression = '';
|
|
100
|
+
for (let index = 0; index < normalized.length; index++) {
|
|
101
|
+
const character = normalized[index];
|
|
102
|
+
if (character === '*') {
|
|
103
|
+
if (normalized[index + 1] === '*') {
|
|
104
|
+
//**/ any directories, ** anything
|
|
105
|
+
if (normalized[index + 2] === '/') {
|
|
106
|
+
expression += '(?:.*/)?';
|
|
107
|
+
index += 2;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
expression += '.*';
|
|
111
|
+
index++;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
expression += '[^/]*';
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else if (character === '?') {
|
|
119
|
+
expression += '[^/]';
|
|
120
|
+
}
|
|
121
|
+
else if (character === '[') {
|
|
122
|
+
const end = normalized.indexOf(']', index + 1);
|
|
123
|
+
if (end < 0) {
|
|
124
|
+
expression += '\\[';
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
expression += `[${normalized.slice(index + 1, end).replace(/^!/, '^').replace(/\\/g, '\\\\')}]`;
|
|
128
|
+
index = end;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
expression += character.replace(/[.+^${}()|\\]/g, '\\$&');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return new RegExp(`^${expression}$`);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The entries of a directory sent to BuildKit, in the order fsutil walks them (lexical, the directories before their
|
|
139
|
+
* content); the parents of the paths included are included
|
|
140
|
+
* @param root
|
|
141
|
+
* @param filter
|
|
142
|
+
*/
|
|
143
|
+
async function walkDirectory(root, filter = {}) {
|
|
144
|
+
const include = [...filter.include ?? []];
|
|
145
|
+
//The targets of the symbolic links followed (the Dockerfile linked)
|
|
146
|
+
for (const follow of filter.followPaths ?? []) {
|
|
147
|
+
try {
|
|
148
|
+
const absolute = node_path_1.default.join(root, follow);
|
|
149
|
+
if ((await (0, promises_1.lstat)(absolute)).isSymbolicLink()) {
|
|
150
|
+
const target = await (0, promises_1.readlink)(absolute);
|
|
151
|
+
const relative = node_path_1.default.posix.normalize(node_path_1.default.posix.join(node_path_1.default.posix.dirname(follow), target)).replace(/^\/+/, '');
|
|
152
|
+
if (!relative.startsWith('..'))
|
|
153
|
+
include.push(relative);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
//Not there
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const includes = include.map(patternExpression);
|
|
161
|
+
const literals = include.map((pattern) => node_path_1.default.posix.normalize(pattern).replace(/^\/+/, '').split(/[*?[]/)[0]);
|
|
162
|
+
const ignore = new DockerIgnore_js_1.DockerIgnore((filter.exclude ?? []).join('\n'));
|
|
163
|
+
const included = (relative, directory) => {
|
|
164
|
+
if (!includes.length)
|
|
165
|
+
return 'yes';
|
|
166
|
+
const parts = relative.split('/');
|
|
167
|
+
for (let length = 1; length <= parts.length; length++) {
|
|
168
|
+
const prefix = parts.slice(0, length).join('/');
|
|
169
|
+
if (includes.some((expression) => expression.test(prefix)))
|
|
170
|
+
return 'yes';
|
|
171
|
+
}
|
|
172
|
+
//A parent of a path included
|
|
173
|
+
if (directory && literals.some((literal) => literal.startsWith(`${relative}/`) || (literal === '' && includes.length > 0)))
|
|
174
|
+
return 'parent';
|
|
175
|
+
return 'no';
|
|
176
|
+
};
|
|
177
|
+
const entries = [];
|
|
178
|
+
const walk = async (relativeDirectory) => {
|
|
179
|
+
const names = (await (0, promises_1.readdir)(node_path_1.default.join(root, relativeDirectory))).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
180
|
+
for (const name of names) {
|
|
181
|
+
const relative = relativeDirectory ? `${relativeDirectory}/${name}` : name;
|
|
182
|
+
const absolute = node_path_1.default.join(root, relative);
|
|
183
|
+
const stats = await (0, promises_1.lstat)(absolute, { bigint: true });
|
|
184
|
+
const directory = stats.isDirectory();
|
|
185
|
+
if (ignore.ignores(relative))
|
|
186
|
+
continue;
|
|
187
|
+
const inclusion = included(relative, directory);
|
|
188
|
+
if (inclusion === 'no')
|
|
189
|
+
continue;
|
|
190
|
+
//The sockets are not sent
|
|
191
|
+
if (stats.isSocket())
|
|
192
|
+
continue;
|
|
193
|
+
const stat = {
|
|
194
|
+
path: relative,
|
|
195
|
+
mode: goFileMode(stats),
|
|
196
|
+
uid: Number(stats.uid),
|
|
197
|
+
gid: Number(stats.gid),
|
|
198
|
+
modTime: stats.mtimeNs
|
|
199
|
+
};
|
|
200
|
+
if (!directory)
|
|
201
|
+
stat.size = Number(stats.size);
|
|
202
|
+
if (stats.isSymbolicLink())
|
|
203
|
+
stat.linkname = await (0, promises_1.readlink)(absolute);
|
|
204
|
+
if (stats.isCharacterDevice() || stats.isBlockDevice()) {
|
|
205
|
+
stat.devmajor = Number(((stats.rdev >> 8n) & 0xfffn) | ((stats.rdev >> 32n) & ~0xfffn));
|
|
206
|
+
stat.devminor = Number((stats.rdev & 0xffn) | ((stats.rdev >> 12n) & ~0xffn));
|
|
207
|
+
}
|
|
208
|
+
entries.push({ path: relative, absolute: absolute, stat: stat, file: stats.isFile() });
|
|
209
|
+
if (directory) {
|
|
210
|
+
const before = entries.length;
|
|
211
|
+
await walk(relative);
|
|
212
|
+
//A parent without any path included under it
|
|
213
|
+
if (inclusion === 'parent' && entries.length === before)
|
|
214
|
+
entries.pop();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
await walk('');
|
|
219
|
+
return entries;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Send a directory as fsutil sends it (FileSync.DiffCopy): its stats, then the files the receiver requests, until it
|
|
223
|
+
* finishes
|
|
224
|
+
* @param call
|
|
225
|
+
* @param root
|
|
226
|
+
*/
|
|
227
|
+
async function sendDirectory(call, root) {
|
|
228
|
+
const entries = await walkDirectory(root, {
|
|
229
|
+
include: call.metadata('include-patterns'),
|
|
230
|
+
exclude: call.metadata('exclude-patterns'),
|
|
231
|
+
followPaths: call.metadata('followpaths')
|
|
232
|
+
});
|
|
233
|
+
let pending = Promise.resolve();
|
|
234
|
+
const sendFile = async (id) => {
|
|
235
|
+
const entry = entries[id];
|
|
236
|
+
if (!entry)
|
|
237
|
+
throw new grpc_1.GRPCError(grpc_1.GRPCStatus.INVALID_ARGUMENT, `The file ${id} is not sent`, call.path);
|
|
238
|
+
if (entry.file) {
|
|
239
|
+
const handle = await (0, promises_1.open)(entry.absolute, 'r');
|
|
240
|
+
try {
|
|
241
|
+
const buffer = Buffer.alloc(CHUNK_SIZE);
|
|
242
|
+
for (;;) {
|
|
243
|
+
const { bytesRead } = await handle.read(buffer, 0, CHUNK_SIZE, null);
|
|
244
|
+
if (!bytesRead)
|
|
245
|
+
break;
|
|
246
|
+
await call.send(B.Packet, { type: B.PacketType.DATA, id: id, data: Buffer.from(buffer.subarray(0, bytesRead)) });
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
finally {
|
|
250
|
+
await handle.close();
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
await call.send(B.Packet, { type: B.PacketType.DATA, id: id });
|
|
254
|
+
};
|
|
255
|
+
const receiving = (async () => {
|
|
256
|
+
for await (const packet of call.requests(B.Packet)) {
|
|
257
|
+
switch (packet.type ?? B.PacketType.STAT) {
|
|
258
|
+
case B.PacketType.REQ: {
|
|
259
|
+
const id = packet.id ?? 0;
|
|
260
|
+
pending = pending.then(() => sendFile(id));
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
case B.PacketType.FIN:
|
|
264
|
+
await pending;
|
|
265
|
+
await call.send(B.Packet, { type: B.PacketType.FIN });
|
|
266
|
+
return;
|
|
267
|
+
case B.PacketType.ERR:
|
|
268
|
+
throw new grpc_1.GRPCError(grpc_1.GRPCStatus.ABORTED, `The receiver of ${root} failed: ${Buffer.from(packet.data ?? []).toString()}`, call.path);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
})();
|
|
272
|
+
receiving.catch(() => undefined);
|
|
273
|
+
for (const entry of entries)
|
|
274
|
+
await call.send(B.Packet, { type: B.PacketType.STAT, stat: entry.stat });
|
|
275
|
+
await call.send(B.Packet, { type: B.PacketType.STAT });
|
|
276
|
+
await receiving;
|
|
277
|
+
await pending;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* A session of BuildKit: a connection of HTTP/2 in the stream of Control.Session, where the daemon calls its methods
|
|
281
|
+
* (the files of the directories of the build, the results exported, the credentials of the registries, its health)
|
|
282
|
+
*/
|
|
283
|
+
class BuildKitSession {
|
|
284
|
+
#server;
|
|
285
|
+
#stream;
|
|
286
|
+
constructor(options) {
|
|
287
|
+
this.options = options;
|
|
288
|
+
this.id = (0, node_crypto_1.randomBytes)(16).toString('hex');
|
|
289
|
+
this.#server = new grpc_1.GRPCServer();
|
|
290
|
+
this.#server.method('/grpc.health.v1.Health/Check', async (call) => {
|
|
291
|
+
await call.request(B.HealthCheckRequest);
|
|
292
|
+
await call.send(B.HealthCheckResponse, { status: 1 });
|
|
293
|
+
});
|
|
294
|
+
this.#server.method('/moby.filesync.v1.FileSync/DiffCopy', async (call) => {
|
|
295
|
+
const name = call.metadata('dir-name')[0] ?? '';
|
|
296
|
+
const directory = this.options.directories[name];
|
|
297
|
+
if (!directory)
|
|
298
|
+
throw new grpc_1.GRPCError(grpc_1.GRPCStatus.NOT_FOUND, `The session has no directory ${name}`, call.path);
|
|
299
|
+
await sendDirectory(call, directory);
|
|
300
|
+
});
|
|
301
|
+
if (this.options.output) {
|
|
302
|
+
this.#server.method('/moby.filesync.v1.FileSend/DiffCopy', async (call) => {
|
|
303
|
+
const output = this.options.output();
|
|
304
|
+
try {
|
|
305
|
+
for await (const message of call.requests(B.BytesMessage)) {
|
|
306
|
+
if (!message.data?.length)
|
|
307
|
+
continue;
|
|
308
|
+
if (!output.write(Buffer.from(message.data)))
|
|
309
|
+
await new Promise((resolve) => void output.once('drain', resolve));
|
|
310
|
+
}
|
|
311
|
+
output.end();
|
|
312
|
+
await (0, promises_2.finished)(output);
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
output.destroy(error);
|
|
316
|
+
throw error;
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
this.#server.method('/moby.filesync.v1.Auth/Credentials', async (call) => {
|
|
321
|
+
const host = (await call.request(B.CredentialsRequest)).host ?? '';
|
|
322
|
+
const credentials = this.credentials(host);
|
|
323
|
+
await call.send(B.CredentialsResponse, credentials?.identityToken ? { secret: credentials.identityToken } : { username: credentials?.username ?? '', secret: credentials?.password ?? '' });
|
|
324
|
+
});
|
|
325
|
+
this.#server.method('/moby.filesync.v1.Auth/FetchToken', async (call) => {
|
|
326
|
+
const request = await call.request(B.FetchTokenRequest);
|
|
327
|
+
const token = await (0, Registry_js_1.fetchRegistryToken)({ realm: request.realm, service: request.service, scopes: request.scopes ?? [] }, this.credentials(request.host ?? ''));
|
|
328
|
+
if (!token)
|
|
329
|
+
throw new grpc_1.GRPCError(grpc_1.GRPCStatus.UNAUTHENTICATED, `The registry ${request.host} gives no token`, call.path);
|
|
330
|
+
await call.send(B.FetchTokenResponse, { token: token.token, expiresIn: token.expiresIn ?? 0, issuedAt: token.issuedAt ?? 0 });
|
|
331
|
+
});
|
|
332
|
+
for (const method of ['GetTokenAuthority', 'VerifyTokenAuthority']) {
|
|
333
|
+
this.#server.method(`/moby.filesync.v1.Auth/${method}`, async (call) => {
|
|
334
|
+
throw new grpc_1.GRPCError(grpc_1.GRPCStatus.UNIMPLEMENTED, `${method} is not implemented`, call.path);
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* The credentials of a host of a registry (Docker Hub by its names)
|
|
340
|
+
* @param host
|
|
341
|
+
* @protected
|
|
342
|
+
*/
|
|
343
|
+
credentials(host) {
|
|
344
|
+
const registry = ['registry-1.docker.io', 'index.docker.io', 'registry.hub.docker.com'].includes(host) ? 'docker.io' : host;
|
|
345
|
+
return this.options.credentials?.(registry) ?? (registry === host ? undefined : this.options.credentials?.(host));
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Open the session: the stream of Control.Session, the methods of the session exposed by its headers
|
|
349
|
+
* @param connection
|
|
350
|
+
* @param signal
|
|
351
|
+
*/
|
|
352
|
+
start(connection, signal) {
|
|
353
|
+
const options = {
|
|
354
|
+
metadata: {
|
|
355
|
+
'x-docker-expose-session-uuid': this.id,
|
|
356
|
+
'x-docker-expose-session-name': this.options.name,
|
|
357
|
+
'x-docker-expose-session-sharedkey': this.options.sharedKey,
|
|
358
|
+
'x-docker-expose-session-grpc-method': this.#server.methods
|
|
359
|
+
},
|
|
360
|
+
signal: signal
|
|
361
|
+
};
|
|
362
|
+
const stream = connection.bidi(`${CONTROL}/Session`, B.BytesMessage, B.BytesMessage, options);
|
|
363
|
+
this.#stream = stream;
|
|
364
|
+
const socket = new node_stream_1.Duplex({
|
|
365
|
+
write: (chunk, _encoding, callback) => {
|
|
366
|
+
stream.send({ data: chunk }).then(() => callback(), (error) => callback(error));
|
|
367
|
+
},
|
|
368
|
+
final: (callback) => {
|
|
369
|
+
stream.end();
|
|
370
|
+
callback();
|
|
371
|
+
},
|
|
372
|
+
read: () => undefined
|
|
373
|
+
});
|
|
374
|
+
(async () => {
|
|
375
|
+
for await (const message of stream.responses)
|
|
376
|
+
if (message.data?.length)
|
|
377
|
+
socket.push(Buffer.from(message.data));
|
|
378
|
+
socket.push(null);
|
|
379
|
+
})().catch(() => {
|
|
380
|
+
socket.push(null);
|
|
381
|
+
});
|
|
382
|
+
this.#server.serve(socket);
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Close the session
|
|
386
|
+
*/
|
|
387
|
+
close() {
|
|
388
|
+
this.#stream?.end();
|
|
389
|
+
this.#stream?.cancel();
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
exports.BuildKitSession = BuildKitSession;
|
|
393
|
+
/**
|
|
394
|
+
* The lines of the progress of a build, as "docker build --progress=plain" shows them: the steps are numbered in their
|
|
395
|
+
* order ("#3 [2/2] RUN npm ci"), with their output, and whether they are cached, done ("#3 DONE 1.2s") or failed
|
|
396
|
+
*/
|
|
397
|
+
class BuildKitProgress {
|
|
398
|
+
#steps = new Map();
|
|
399
|
+
#pending = new Map();
|
|
400
|
+
step(digest) {
|
|
401
|
+
let step = this.#steps.get(digest);
|
|
402
|
+
if (!step)
|
|
403
|
+
this.#steps.set(digest, step = { number: this.#steps.size + 1, started: false, ended: false });
|
|
404
|
+
return step;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* The lines of a status of the build
|
|
408
|
+
* @param status
|
|
409
|
+
*/
|
|
410
|
+
lines(status) {
|
|
411
|
+
const lines = [];
|
|
412
|
+
for (const vertex of status.vertexes ?? []) {
|
|
413
|
+
const step = this.step(vertex.digest);
|
|
414
|
+
const started = (0, ContainerdClient_js_1.timestampDate)(vertex.started);
|
|
415
|
+
const completed = (0, ContainerdClient_js_1.timestampDate)(vertex.completed);
|
|
416
|
+
if (!step.started && (started || vertex.cached)) {
|
|
417
|
+
step.started = true;
|
|
418
|
+
lines.push(`#${step.number} ${vertex.name}`);
|
|
419
|
+
}
|
|
420
|
+
if (step.ended)
|
|
421
|
+
continue;
|
|
422
|
+
if (vertex.cached) {
|
|
423
|
+
step.ended = true;
|
|
424
|
+
lines.push(`#${step.number} CACHED`);
|
|
425
|
+
}
|
|
426
|
+
else if (vertex.error) {
|
|
427
|
+
step.ended = true;
|
|
428
|
+
lines.push(...this.flush(vertex.digest), `#${step.number} ERROR: ${vertex.error}`);
|
|
429
|
+
}
|
|
430
|
+
else if (completed) {
|
|
431
|
+
step.ended = true;
|
|
432
|
+
const seconds = started ? ` ${((completed.getTime() - started.getTime()) / 1000).toFixed(1)}s` : '';
|
|
433
|
+
lines.push(...this.flush(vertex.digest), `#${step.number} DONE${seconds}`);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
for (const log of status.logs ?? []) {
|
|
437
|
+
const output = (this.#pending.get(log.vertex) ?? '') + Buffer.from(log.msg ?? []).toString();
|
|
438
|
+
const parts = output.split(/\r?\n/);
|
|
439
|
+
this.#pending.set(log.vertex, parts.pop());
|
|
440
|
+
const number = this.step(log.vertex).number;
|
|
441
|
+
parts.forEach((part) => lines.push(`#${number} ${part}`));
|
|
442
|
+
}
|
|
443
|
+
for (const warning of status.warnings ?? [])
|
|
444
|
+
lines.push(`#${this.step(warning.vertex).number} WARN: ${Buffer.from(warning.short ?? []).toString()}`);
|
|
445
|
+
return lines;
|
|
446
|
+
}
|
|
447
|
+
flush(digest) {
|
|
448
|
+
const pending = this.#pending.get(digest);
|
|
449
|
+
this.#pending.delete(digest);
|
|
450
|
+
return pending ? [`#${this.step(digest).number} ${pending}`] : [];
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
exports.BuildKitProgress = BuildKitProgress;
|
|
454
|
+
/**
|
|
455
|
+
* Build an image with BuildKit (its Dockerfile frontend): its context and its Dockerfile sent by the session, the image
|
|
456
|
+
* exported to the client as an archive (the oci exporter); the daemon is local or remote, of any worker
|
|
457
|
+
* @param connection
|
|
458
|
+
* @param options
|
|
459
|
+
*/
|
|
460
|
+
async function buildKitBuild(connection, options) {
|
|
461
|
+
const context = node_path_1.default.resolve(options.context);
|
|
462
|
+
const dockerfile = node_path_1.default.resolve(context, options.dockerfile ?? 'Dockerfile');
|
|
463
|
+
const session = new BuildKitSession({
|
|
464
|
+
name: options.name,
|
|
465
|
+
sharedKey: context,
|
|
466
|
+
directories: { context: context, dockerfile: node_path_1.default.dirname(dockerfile) },
|
|
467
|
+
credentials: options.credentials,
|
|
468
|
+
output: () => (0, node_fs_1.createWriteStream)(options.output)
|
|
469
|
+
});
|
|
470
|
+
const abort = new AbortController();
|
|
471
|
+
const signal = options.signal ? AbortSignal.any([options.signal, abort.signal]) : abort.signal;
|
|
472
|
+
session.start(connection, signal);
|
|
473
|
+
const ref = (0, node_crypto_1.randomBytes)(16).toString('hex');
|
|
474
|
+
const progress = new BuildKitProgress();
|
|
475
|
+
const status = (async () => {
|
|
476
|
+
if (!options.progress)
|
|
477
|
+
return;
|
|
478
|
+
for await (const response of connection.serverStream(`${CONTROL}/Status`, B.StatusRequest, { ref: ref }, B.StatusResponse, { signal: signal })) {
|
|
479
|
+
for (const line of progress.lines(response))
|
|
480
|
+
options.progress(line);
|
|
481
|
+
}
|
|
482
|
+
})().catch(() => undefined);
|
|
483
|
+
const frontendAttrs = { filename: node_path_1.default.basename(dockerfile) };
|
|
484
|
+
if (options.target)
|
|
485
|
+
frontendAttrs.target = options.target;
|
|
486
|
+
for (const [key, value] of Object.entries(options.buildArgs ?? {}))
|
|
487
|
+
frontendAttrs[`build-arg:${key}`] = value;
|
|
488
|
+
for (const [key, value] of Object.entries(options.labels ?? {}))
|
|
489
|
+
frontendAttrs[`label:${key}`] = value;
|
|
490
|
+
if (options.platforms?.length)
|
|
491
|
+
frontendAttrs.platform = options.platforms.map((platform) => (0, Platforms_js_1.formatPlatform)((0, Platforms_js_1.normalizePlatform)(platform))).join(',');
|
|
492
|
+
if (options.noCache)
|
|
493
|
+
frontendAttrs['no-cache'] = '';
|
|
494
|
+
if (options.pull)
|
|
495
|
+
frontendAttrs['image-resolve-mode'] = 'pull';
|
|
496
|
+
try {
|
|
497
|
+
const response = await connection.unary(`${CONTROL}/Solve`, B.SolveRequest, {
|
|
498
|
+
ref: ref,
|
|
499
|
+
session: session.id,
|
|
500
|
+
frontend: 'dockerfile.v0',
|
|
501
|
+
frontendAttrs: frontendAttrs,
|
|
502
|
+
exporter: 'oci',
|
|
503
|
+
exporterAttrs: { name: options.name }
|
|
504
|
+
}, B.SolveResponse, { signal: signal });
|
|
505
|
+
await status;
|
|
506
|
+
return response.exporterResponse ?? {};
|
|
507
|
+
}
|
|
508
|
+
finally {
|
|
509
|
+
abort.abort();
|
|
510
|
+
session.close();
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* The version of BuildKit
|
|
515
|
+
* @param connection
|
|
516
|
+
*/
|
|
517
|
+
async function buildKitVersion(connection) {
|
|
518
|
+
const response = await connection.unary(`${CONTROL}/Info`, {}, {}, B.InfoResponse);
|
|
519
|
+
return { package: response.buildkitVersion?.package ?? '', version: response.buildkitVersion?.version ?? '', revision: response.buildkitVersion?.revision ?? '' };
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* The platforms the workers of BuildKit build
|
|
523
|
+
* @param connection
|
|
524
|
+
*/
|
|
525
|
+
async function buildKitPlatforms(connection) {
|
|
526
|
+
const response = await connection.unary(`${CONTROL}/ListWorkers`, B.ListWorkersRequest, {}, B.ListWorkersResponse);
|
|
527
|
+
const platforms = [];
|
|
528
|
+
for (const record of response.record ?? []) {
|
|
529
|
+
for (const platform of record.platforms ?? []) {
|
|
530
|
+
const normalized = (0, Platforms_js_1.normalizePlatform)({ os: platform.os, architecture: platform.architecture, variant: platform.variant || undefined });
|
|
531
|
+
if (!platforms.some((known) => (0, Platforms_js_1.formatPlatform)(known) === (0, Platforms_js_1.formatPlatform)(normalized)))
|
|
532
|
+
platforms.push(normalized);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
return platforms;
|
|
536
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Schema } from '@lakutata/grpc';
|
|
2
|
+
export declare const BytesMessage: Schema;
|
|
3
|
+
export declare const ExporterMessage: Schema;
|
|
4
|
+
export declare const SolveRequest: Schema;
|
|
5
|
+
export declare const SolveResponse: Schema;
|
|
6
|
+
export declare const StatusRequest: Schema;
|
|
7
|
+
export declare const Vertex: Schema;
|
|
8
|
+
export declare const VertexStatus: Schema;
|
|
9
|
+
export declare const VertexLog: Schema;
|
|
10
|
+
export declare const VertexWarning: Schema;
|
|
11
|
+
export declare const StatusResponse: Schema;
|
|
12
|
+
export declare const BuildkitVersion: Schema;
|
|
13
|
+
export declare const InfoResponse: Schema;
|
|
14
|
+
export declare const BuildKitPlatform: Schema;
|
|
15
|
+
export declare const WorkerRecord: Schema;
|
|
16
|
+
export declare const ListWorkersRequest: Schema;
|
|
17
|
+
export declare const ListWorkersResponse: Schema;
|
|
18
|
+
/**
|
|
19
|
+
* The types of the packets of fsutil
|
|
20
|
+
*/
|
|
21
|
+
export declare enum PacketType {
|
|
22
|
+
STAT = 0,
|
|
23
|
+
REQ = 1,
|
|
24
|
+
DATA = 2,
|
|
25
|
+
FIN = 3,
|
|
26
|
+
ERR = 4
|
|
27
|
+
}
|
|
28
|
+
export declare const Stat: Schema;
|
|
29
|
+
export declare const Packet: Schema;
|
|
30
|
+
export declare const CredentialsRequest: Schema;
|
|
31
|
+
export declare const CredentialsResponse: Schema;
|
|
32
|
+
export declare const FetchTokenRequest: Schema;
|
|
33
|
+
export declare const FetchTokenResponse: Schema;
|
|
34
|
+
export declare const HealthCheckRequest: Schema;
|
|
35
|
+
export declare const HealthCheckResponse: Schema;
|