From f0d04e6b16b8267ad441b4f17379439af5d2dcea Mon Sep 17 00:00:00 2001 From: James Addison Date: Sun, 10 Oct 2021 17:49:47 +0100 Subject: [PATCH] Throw an error when both 'platform' and 'arch' options are supplied during a build --- src/buildah.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/buildah.ts b/src/buildah.ts index db351c4..1afe866 100644 --- a/src/buildah.ts +++ b/src/buildah.ts @@ -67,6 +67,9 @@ export class BuildahCli implements Buildah { useOCI: boolean, arch: string, platform: string, layers: string, extraArgs: string[] ): Promise { const args: string[] = [ "bud" ]; + if (arch && platform) { + throw new Error("The --platform option may not be used in combination with the --arch option."); + } if (arch) { args.push("--arch"); args.push(arch); @@ -122,6 +125,9 @@ export class BuildahCli implements Buildah { core.debug("config"); core.debug(container); const args: string[] = [ "config" ]; + if (settings.arch && settings.platform) { + throw new Error("The --platform option may not be used in combination with the --arch option."); + } if (settings.entrypoint) { args.push("--entrypoint"); args.push(BuildahCli.convertArrayToStringArg(settings.entrypoint)); @@ -186,10 +192,6 @@ export class BuildahCli implements Buildah { ): Promise { // ghCore.info(`${EXECUTABLE} ${args.join(" ")}`) - if (args.arch && args.platform) { - throw new Error("The --platform option may not be used in combination with the --arch option."); - } - let stdout = ""; let stderr = "";