From 6f25a1fe6b78ea250c764443b0e88872a9265911 Mon Sep 17 00:00:00 2001 From: Valentin Agachi Date: Thu, 17 Oct 2024 13:47:15 +0200 Subject: [PATCH] chore: Wrap engine exec in logs group (#1146) --- .../src/executors/build/executor.ts | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/plugins/nx-container/src/executors/build/executor.ts b/plugins/nx-container/src/executors/build/executor.ts index 997cf19a..72727d1c 100644 --- a/plugins/nx-container/src/executors/build/executor.ts +++ b/plugins/nx-container/src/executors/build/executor.ts @@ -38,19 +38,22 @@ const runExecutor: PromiseExecutor = async (options, ctx) = const args: string[] = await engine.getArgs(inputs, defContext); const buildCmd = engine.getCommand(args); - await getExecOutput( - buildCmd.command, - buildCmd.args.map((arg) => interpolate(arg)), - { - ignoreReturnCode: true, - } - ).then((res) => { - if (res.stderr.length > 0 && res.exitCode != 0) { - throw new Error(`buildx failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`); - } - }); - await engine.finalize(inputs, ctx); + await logger.group('Build', async () => { + await getExecOutput( + buildCmd.command, + buildCmd.args.map((arg) => interpolate(arg)), + { + ignoreReturnCode: true, + } + ).then((res) => { + if (res.stderr.length > 0 && res.exitCode != 0) { + throw new Error(`buildx failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`); + } + }); + + await engine.finalize(inputs, ctx); + }); const imageID = await engine.getImageID(); const metadata = await engine.getMetadata();