diff --git a/packages/cli/src/commands/index.ts b/packages/cli/src/commands/index.ts index d3ca004a12..8fd9a336b8 100644 --- a/packages/cli/src/commands/index.ts +++ b/packages/cli/src/commands/index.ts @@ -190,6 +190,11 @@ export function registerScriptCommand(program: Command) { '-m, --marketplace-file ', 'Marketplace yaml file. This is a Plugin entity definition for Marketplace.', ) + .option( + '--platform ', + 'Platform to use when building the container image. Default is "linux/amd64". Can be set to "" to not set --platfrom flag in builder command.', + 'linux/amd64', + ) .action( lazy(() => import('./package-dynamic-plugins').then(m => m.command)), ); diff --git a/packages/cli/src/commands/package-dynamic-plugins/command.ts b/packages/cli/src/commands/package-dynamic-plugins/command.ts index d2942bfd3a..d760a6a67f 100644 --- a/packages/cli/src/commands/package-dynamic-plugins/command.ts +++ b/packages/cli/src/commands/package-dynamic-plugins/command.ts @@ -20,6 +20,7 @@ export async function command(opts: OptionValues): Promise { tag, useDocker, marketplaceFile, + platform, } = opts; if (!exportTo && !tag) { Task.error( @@ -236,6 +237,9 @@ export async function command(opts: OptionValues): Promise { `--annotation io.backstage.marketplace/${pluginName}='${base64pluginInfo}'`, ); } + if (platform) { + flags.push(`--platform ${platform}`); + } // run the command to generate the image Task.log(`Creating image using ${containerTool}`); await Task.forCommand(