bake: missing overrides when parsing definition

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2023-04-18 14:16:46 +02:00
parent 0f6ebcb798
commit dba2a69f61
3 changed files with 52 additions and 4 deletions

View File

@@ -32,7 +32,7 @@ export class Bake {
this.buildx = opts?.buildx || new Buildx();
}
public async parseDefinitions(sources: Array<string>, targets: Array<string>, workdir?: string): Promise<BakeDefinition> {
public async parseDefinitions(sources: Array<string>, targets?: Array<string>, overrides?: Array<string>, load?: boolean, push?: boolean, workdir?: string): Promise<BakeDefinition> {
const args = ['bake'];
let remoteDef;
@@ -58,8 +58,19 @@ export class Bake {
for (const file of files) {
args.push('--file', file);
}
if (overrides) {
for (const override of overrides) {
args.push('--set', override);
}
}
if (load) {
args.push('--load');
}
if (push) {
args.push('--push');
}
const printCmd = await this.buildx.getCommand([...args, '--print', ...targets]);
const printCmd = await this.buildx.getCommand([...args, '--print', ...(targets || [])]);
return await Exec.getExecOutput(printCmd.command, printCmd.args, {
cwd: workdir,
ignoreReturnCode: true,