Skip to content

Commit

Permalink
feat: add verbose logging of build command and stdout in nx-container
Browse files Browse the repository at this point in the history
Add verbose logging of build command and stdout in nx-container. fix gperdomor#1127
  • Loading branch information
Alexander Fougner committed Sep 5, 2024
1 parent df60124 commit 68d93e7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugins/nx-container/src/executors/build/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,18 @@ const runExecutor: PromiseExecutor<BuildExecutorSchema> = async (options, ctx) =

const args: string[] = await engine.getArgs(inputs, defContext);
const buildCmd = engine.getCommand(args);

logger.verbose(`Build command: ${buildCmd.command} ${buildCmd.args.join(' ')}`);

await getExecOutput(
buildCmd.command,
buildCmd.args.map((arg) => interpolate(arg)),
{
ignoreReturnCode: true,
}
).then((res) => {
logger.verbose(res.stdout);

if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(`buildx failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
}
Expand Down

0 comments on commit 68d93e7

Please sign in to comment.