builder: support features in inspect command

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2024-03-08 11:49:58 +01:00
parent 225d61b701
commit 9436c6ca61
No known key found for this signature in database
GPG Key ID: ADE44D8C9D44FBE4
4 changed files with 21 additions and 0 deletions

View File

@ -415,6 +415,12 @@ describe('parseInspect', () => {
"name": "builder0",
"platforms": "linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6",
"status": "running",
"features": {
"Cache export": true,
"Docker exporter": true,
"Multi-platform build": true,
"OCI exporter": true,
},
"labels": {
"org.mobyproject.buildkit.worker.executor": "oci",
"org.mobyproject.buildkit.worker.hostname": "docker-desktop",

View File

@ -10,6 +10,11 @@ Status: running
BuildKit daemon flags: --debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host --allow-insecure-entitlement=network.host
BuildKit version: 37657a1
Platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
Features:
Cache export: true
Docker exporter: true
Multi-platform build: true
OCI exporter: true
Labels:
org.mobyproject.buildkit.worker.executor: oci
org.mobyproject.buildkit.worker.hostname: docker-desktop

View File

@ -149,6 +149,10 @@ export class Builder {
currentNode.platforms = platforms.join(',');
break;
}
case lkey == 'features':
parsingType = 'features';
currentNode.features = {};
break;
case lkey == 'labels':
parsingType = 'label';
currentNode.labels = {};
@ -162,6 +166,11 @@ export class Builder {
break;
default: {
switch (parsingType || '') {
case 'features': {
currentNode.features = currentNode.features || {};
currentNode.features[key.trim()] = Boolean(value);
break;
}
case 'label': {
currentNode.labels = currentNode.labels || {};
currentNode.labels[key.trim()] = value;

View File

@ -32,6 +32,7 @@ export interface Node {
export interface NodeInfo extends Node {
status?: string;
buildkit?: string;
features?: Record<string, boolean>;
labels?: Record<string, string>;
gcPolicy?: Array<GCPolicy>;
}