Merge pull request #560 from crazy-max/builder-inspect-file
Some checks failed
publish / publish (push) Has been cancelled
Some checks failed
publish / publish (push) Has been cancelled
builder: support files in inspect command
This commit is contained in:
@@ -37,3 +37,15 @@ GC Policy rule#2:
|
|||||||
GC Policy rule#3:
|
GC Policy rule#3:
|
||||||
All: true
|
All: true
|
||||||
Keep Bytes: 94.06GiB
|
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
|
||||||
|
>
|
||||||
|
|||||||
@@ -449,7 +449,19 @@ describe('parseInspect', () => {
|
|||||||
"all": true,
|
"all": true,
|
||||||
"keepBytes": "94.06GiB",
|
"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
|
||||||
|
`,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ export class Builder {
|
|||||||
let parsingType: string | undefined;
|
let parsingType: string | undefined;
|
||||||
let currentNode: NodeInfo = {};
|
let currentNode: NodeInfo = {};
|
||||||
let currentGCPolicy: GCPolicy | undefined;
|
let currentGCPolicy: GCPolicy | undefined;
|
||||||
|
let currentFile: string | undefined;
|
||||||
for (const line of data.trim().split(`\n`)) {
|
for (const line of data.trim().split(`\n`)) {
|
||||||
const [key, ...rest] = line.split(':');
|
const [key, ...rest] = line.split(':');
|
||||||
const lkey = key.toLowerCase();
|
const lkey = key.toLowerCase();
|
||||||
@@ -178,6 +179,12 @@ export class Builder {
|
|||||||
currentGCPolicy = undefined;
|
currentGCPolicy = undefined;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case lkey.startsWith('file#'):
|
||||||
|
parsingType = 'file';
|
||||||
|
currentFile = key.split('#')[1];
|
||||||
|
currentNode.files = currentNode.files || {};
|
||||||
|
currentNode.files[currentFile] = '';
|
||||||
|
break;
|
||||||
default: {
|
default: {
|
||||||
switch (parsingType || '') {
|
switch (parsingType || '') {
|
||||||
case 'features': {
|
case 'features': {
|
||||||
@@ -215,6 +222,15 @@ export class Builder {
|
|||||||
}
|
}
|
||||||
break;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export interface NodeInfo extends Node {
|
|||||||
features?: Record<string, boolean>;
|
features?: Record<string, boolean>;
|
||||||
labels?: Record<string, string>;
|
labels?: Record<string, string>;
|
||||||
gcPolicy?: Array<GCPolicy>;
|
gcPolicy?: Array<GCPolicy>;
|
||||||
|
files?: Record<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GCPolicy {
|
export interface GCPolicy {
|
||||||
|
|||||||
Reference in New Issue
Block a user