builder: fix breaking change on node fields

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2023-02-24 19:41:10 +01:00
parent 2e59ae7030
commit 9128f56258
5 changed files with 31 additions and 36 deletions

View File

@@ -39,14 +39,14 @@ export class BuildKit {
}
public async getVersion(node: NodeInfo): Promise<string | undefined> {
if (!node.buildkitVersion && node.name) {
if (!node.buildkit && node.name) {
try {
return await this.getVersionWithinImage(node.name);
} catch (e) {
core.warning(e);
}
}
return node.buildkitVersion;
return node.buildkit;
}
private async getVersionWithinImage(nodeName: string): Promise<string> {
@@ -80,7 +80,7 @@ export class BuildKit {
builderInfo = await new Builder({buildx: this.buildx}).inspect(builderName);
}
for (const node of builderInfo.nodes) {
let bkversion = node.buildkitVersion;
let bkversion = node.buildkit;
core.debug(`BuildKit.versionSatisfies ${bkversion}: ${range}`);
if (!bkversion) {
try {

View File

@@ -80,7 +80,7 @@ export class Builder {
break;
}
case 'driver options': {
node.driverOpts = (value.match(/(\w+)="([^"]*)"/g) || []).map(v => v.replace(/^(.*)="(.*)"$/g, '$1=$2'));
node['driver-opts'] = (value.match(/(\w+)="([^"]*)"/g) || []).map(v => v.replace(/^(.*)="(.*)"$/g, '$1=$2'));
break;
}
case 'status': {
@@ -88,11 +88,11 @@ export class Builder {
break;
}
case 'flags': {
node.buildkitdFlags = value;
node['buildkitd-flags'] = value;
break;
}
case 'buildkit': {
node.buildkitVersion = value;
node.buildkit = value;
break;
}
case 'platforms': {

View File

@@ -21,16 +21,6 @@ export interface BuilderInfo {
nodes: NodeInfo[];
}
export interface NodeInfo {
name?: string;
endpoint?: string;
driverOpts?: Array<string>;
status?: string;
buildkitdFlags?: string;
buildkitVersion?: string;
platforms?: string;
}
export interface Node {
name?: string;
endpoint?: string;
@@ -38,3 +28,8 @@ export interface Node {
'buildkitd-flags'?: string;
platforms?: string;
}
export interface NodeInfo extends Node {
status?: string;
buildkit?: string;
}