Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions __tests__/.fixtures/inspect11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,15 @@ GC Policy rule#2:
GC Policy rule#3:
All: true
Keep Bytes: 94.06GiB
File#buildkitd.toml:
> debug = true
> insecure-entitlements = ["network.host", "security.insecure"]
> trace = true
>
> [log]
> format = "text"
>
File#foo.txt:
> foo = bar
> baz = qux
>
14 changes: 13 additions & 1 deletion __tests__/buildx/builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,19 @@ describe('parseInspect', () => {
"all": true,
"keepBytes": "94.06GiB",
}
]
],
"files": {
"buildkitd.toml": `debug = true
insecure-entitlements = ["network.host", "security.insecure"]
trace = true

[log]
format = "text"
`,
"foo.txt": `foo = bar
baz = qux
`,
}
}
]
}
Expand Down
16 changes: 16 additions & 0 deletions src/buildx/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class Builder {
let parsingType: string | undefined;
let currentNode: NodeInfo = {};
let currentGCPolicy: GCPolicy | undefined;
let currentFile: string | undefined;
for (const line of data.trim().split(`\n`)) {
const [key, ...rest] = line.split(':');
const lkey = key.toLowerCase();
Expand Down Expand Up @@ -178,6 +179,12 @@ export class Builder {
currentGCPolicy = undefined;
}
break;
case lkey.startsWith('file#'):
parsingType = 'file';
currentFile = key.split('#')[1];
currentNode.files = currentNode.files || {};
currentNode.files[currentFile] = '';
break;
default: {
switch (parsingType || '') {
case 'features': {
Expand Down Expand Up @@ -215,6 +222,15 @@ export class Builder {
}
break;
}
case 'file': {
if (currentFile && currentNode.files) {
if (currentNode.files[currentFile].length > 0) {
currentNode.files[currentFile] += '\n';
}
currentNode.files[currentFile] += line.replace(/^\s>\s?/, '');
}
break;
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/types/buildx/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface NodeInfo extends Node {
features?: Record<string, boolean>;
labels?: Record<string, string>;
gcPolicy?: Array<GCPolicy>;
files?: Record<string, string>;
}

export interface GCPolicy {
Expand Down