Skip to content

Commit

Permalink
chore: Wrap engine exec in logs group (#1146)
Browse files Browse the repository at this point in the history
  • Loading branch information
avaly authored Oct 17, 2024
1 parent d5b842e commit 6f25a1f
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions plugins/nx-container/src/executors/build/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,22 @@ const runExecutor: PromiseExecutor<BuildExecutorSchema> = 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();
Expand Down

0 comments on commit 6f25a1f

Please sign in to comment.