Skip to content

Conversation

@ehmicky
Copy link
Contributor

@ehmicky ehmicky commented Dec 10, 2021

Fixes #3933

This adds a verbose CLI flag. The default value is false.

It can be enabled with the environment variable NETLIFY_BUILD_DEBUG=true (just like the debug CLI flag). The reason this is using a separate CLI flag is because the verbose is false in tests while debug is true, since verbose logs make test snapshots harder to read.

The verbose CLI flag has the same purpose as the debug flag, but for more verbose log messages.

At the moment, it prints messages indicating the different steps of plugins orchestration and IPC. This allows us to debug issues related to plugins hanging.


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

@ehmicky ehmicky added the type: chore work needed to keep the product and development running smoothly label Dec 10, 2021
@ehmicky ehmicky self-assigned this Dec 10, 2021
@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Dec 10, 2021
@ehmicky ehmicky requested a review from JGAntunes December 10, 2021 17:47
}

const logPluginMethodStart = function (verbose) {
logVerbose(undefined, verbose, 'Plugin logic started.')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logs is undefined when inside the plugin's child process, which is normal.

1. ./plugin (onPreBuild event) ␊
────────────────────────────────────────────────────────────────␊
Step starting.␊
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main process is about to send message to plugin process.

────────────────────────────────────────────────────────────────␊
Step starting.␊
Step started.␊
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main process successfully sent message to plugin process.

Step starting.␊
Step started.␊
Plugin logic started.␊
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plugin process is about to execute plugin event handler.

Step started.␊
Plugin logic started.␊
test␊
Plugin logic ended.␊
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plugin event handler completed.

Plugin logic started.␊
test␊
Plugin logic ended.␊
Stop closing.␊
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plugin process is about to send its response message to the main process.

Plugin logic ended.␊
Stop closing.␊
Step closed.␊
Step ended.␊
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main process received the plugin process's response message for this step.

Stop closing.␊
Step closed.␊
Step ended.␊
Step completed.␊
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main process disconnected stdout/stderr from the plugin's process.

@ehmicky ehmicky changed the title feat: add a verbose flag feat: add a verbose flag Dec 10, 2021
@ehmicky ehmicky removed the type: feature code contributing to the implementation of a feature and/or user facing functionality label Dec 10, 2021
Copy link
Contributor

@JGAntunes JGAntunes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment which we can revisit later, but LGTM 👍

Comment on lines 135 to 144
debug: {
boolean: true,
describe: 'Print debugging information',
describe: 'Print user-facing debugging information',
hidden: true,
},
verbose: {
boolean: true,
describe: 'Print internal debugging information',
hidden: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the need for this ASAP I'm ok with the flag, but what do you think of having debug levels in the future? It would be more suited IMO vs these flags which can be confusing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was thinking this should be the next step as well!

Note than from a user standpoint, they use the NETLIFY_BUILD_DEBUG environment variable for both debug and verbose, so there's currently a single level from their perspective. The buildbot and CLI do not pass the verbose flag, so the only difference is for the tests, which sets verbose as false and debug as true.

@kodiakhq kodiakhq bot merged commit d7c9fd1 into main Dec 10, 2021
@kodiakhq kodiakhq bot deleted the feat/verbose branch December 10, 2021 18:58
@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge type: chore work needed to keep the product and development running smoothly type: feature code contributing to the implementation of a feature and/or user facing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add more debug messages for plugins orchestration and IPC

3 participants