Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug information when nx is run in verbose #1127

Open
Evanion opened this issue Sep 5, 2024 · 0 comments · May be fixed by #1128
Open

Add debug information when nx is run in verbose #1127

Evanion opened this issue Sep 5, 2024 · 0 comments · May be fixed by #1128

Comments

@Evanion
Copy link
Contributor

Evanion commented Sep 5, 2024

I'm trying to setup our prject to use nx-container but It would really help if there was some output about what the package is doing when running with NX_VERBOSE_LOGGING=true or nx <command> --verbose

I tried cloning the repo, and doing the changes myself, but when husky tries to validate package-lock.json, it can't read it.. It's probably something to do with my corporate windows computer (i know husky have issues with windows).

In plugins/nx-container/src/executors/build/ executor.ts I propose the following additions:

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

    logger.verbose(`Build command: ${buildCmd.command} ${buildCmd.args.join(' ')}`); // <-- first addition

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

      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);
//...

This would let you see the final build command that is sent to docker or what ever engine you are using, and It will let you see the output from that command.

Alexamakans pushed a commit to Alexamakans/nx-tools that referenced this issue Sep 5, 2024
Add verbose logging of build command and stdout in nx-container. fix gperdomor#1127
Alexamakans pushed a commit to Alexamakans/nx-tools that referenced this issue Sep 5, 2024
…n nx-container

Add verbose logging of build command and stdout in nx-container. fix gperdomor#1127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant