Skip to content

Commit 9436c6c

Browse files
committed
builder: support features in inspect command
Signed-off-by: CrazyMax <[email protected]>
1 parent 225d61b commit 9436c6c

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

__tests__/buildx/builder.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,12 @@ describe('parseInspect', () => {
415415
"name": "builder0",
416416
"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",
417417
"status": "running",
418+
"features": {
419+
"Cache export": true,
420+
"Docker exporter": true,
421+
"Multi-platform build": true,
422+
"OCI exporter": true,
423+
},
418424
"labels": {
419425
"org.mobyproject.buildkit.worker.executor": "oci",
420426
"org.mobyproject.buildkit.worker.hostname": "docker-desktop",

__tests__/fixtures/inspect11.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ Status: running
1010
BuildKit daemon flags: --debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host --allow-insecure-entitlement=network.host
1111
BuildKit version: 37657a1
1212
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
13+
Features:
14+
Cache export: true
15+
Docker exporter: true
16+
Multi-platform build: true
17+
OCI exporter: true
1318
Labels:
1419
org.mobyproject.buildkit.worker.executor: oci
1520
org.mobyproject.buildkit.worker.hostname: docker-desktop

src/buildx/builder.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ export class Builder {
149149
currentNode.platforms = platforms.join(',');
150150
break;
151151
}
152+
case lkey == 'features':
153+
parsingType = 'features';
154+
currentNode.features = {};
155+
break;
152156
case lkey == 'labels':
153157
parsingType = 'label';
154158
currentNode.labels = {};
@@ -162,6 +166,11 @@ export class Builder {
162166
break;
163167
default: {
164168
switch (parsingType || '') {
169+
case 'features': {
170+
currentNode.features = currentNode.features || {};
171+
currentNode.features[key.trim()] = Boolean(value);
172+
break;
173+
}
165174
case 'label': {
166175
currentNode.labels = currentNode.labels || {};
167176
currentNode.labels[key.trim()] = value;

src/types/builder.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface Node {
3232
export interface NodeInfo extends Node {
3333
status?: string;
3434
buildkit?: string;
35+
features?: Record<string, boolean>;
3536
labels?: Record<string, string>;
3637
gcPolicy?: Array<GCPolicy>;
3738
}

0 commit comments

Comments
 (0)