ci: Add a new option silentLogs for cleaner CI/build output#2563
ci: Add a new option silentLogs for cleaner CI/build output#2563RulaKhaled wants to merge 2 commits intomasterfrom
silentLogs for cleaner CI/build output#2563Conversation
silentLogs for cleaner CI/build output
szokeasaurusrex
left a comment
There was a problem hiding this comment.
Generally seems okay, did have a few minor suggestions though (and also want to be sure that this is non-breaking)
js/helper.js
Outdated
| } else if (args[1] === 'finalize' && args[2]) { | ||
| return `✓ Release ${args[2]} finalized`; | ||
| } else if (args[1] === 'files' && args[3] === 'upload-sourcemaps' && args[2]) { | ||
| return `✓ Source maps uploaded to release ${args[2]}`; |
There was a problem hiding this comment.
[nit] We should align the output here with the output for sourcemaps upload (note that sentry-cli releases files upload-sourcemaps is deprecated). Either both should include the release (if present), or likely simpler is just to remove the output from both.
js/helper.js
Outdated
| case 'upload-dif': | ||
| return `✓ Debug information files uploaded`; | ||
|
|
||
| case 'upload-dsym': | ||
| return `✓ dSYM files uploaded`; |
There was a problem hiding this comment.
These commands are both deprecated aliases of debug-files upload, so output should be the same
| case 'upload-dif': | |
| return `✓ Debug information files uploaded`; | |
| case 'upload-dsym': | |
| return `✓ dSYM files uploaded`; | |
| case 'upload-dif': | |
| case 'upload-dsym': | |
| return `✓ Debug files uploaded`; |
js/helper.js
Outdated
| case 'mobile-app': | ||
| if (args[1] === 'upload') { | ||
| return `✓ Mobile app uploaded`; | ||
| } | ||
| break; |
There was a problem hiding this comment.
Let's not add this yet, this command is still a work in progress.
| case 'mobile-app': | |
| if (args[1] === 'upload') { | |
| return `✓ Mobile app uploaded`; | |
| } | |
| break; |
js/helper.js
Outdated
| case 'send-metric': | ||
| return `✓ Metric sent`; |
There was a problem hiding this comment.
Maybe not necessary to add this either, as metrics are deprecated, and will be rejected if users attempt to send them to Sentry SaaS
| case 'send-metric': | |
| return `✓ Metric sent`; |
| * Determines an appropriate success message based on the command. | ||
| * | ||
| * @param {string[]} args Command line arguments passed to sentry-cli | ||
| * @returns {string|null} Success message to display or null if no message needed |
There was a problem hiding this comment.
Maybe it is preferable to type this just as string, using empty string instead of null? Not sure how we typically do it in JS, so I'll defer to you on this.
| * @returns {string|null} Success message to display or null if no message needed | |
| * @returns {string} Success message to display or empty string if no message needed |
There was a problem hiding this comment.
Returning null expresses that "there is no success message to show" rather than "the success message is empty".
It is more consistent with JavaScript best practices for optional values.
| * @returns {Promise.<string>} A promise that resolves to the standard output. | ||
| */ | ||
| async function execute(args, live, silent, configFile, config = {}) { | ||
| async function execute(args, live, silent, silentLogs, configFile, config = {}) { |
There was a problem hiding this comment.
Is this part of public API?
There was a problem hiding this comment.
I think users should only use the execute method provided by the SentryCli class
d26527b to
4e33b73
Compare
| } else if (silentLogs && live !== 'rejectOnError') { | ||
| // Capture stdout to filter it, but show stderr for errors | ||
| // Not applicable for rejectOnError mode which needs to capture output | ||
| stdio = ['ignore', 'pipe', 'inherit']; |
There was a problem hiding this comment.
Bug: Sentry CLI Hangs on Unread Piped Output
When silentLogs is true and live is true (but not 'rejectOnError'), the sentry-cli child process's stdout is configured as 'pipe' but is never read by the parent process. This can cause the child process to block or hang if it produces substantial output that fills the pipe buffer. The piped stdout should either be drained or the stdio option for stdout should be set to 'ignore'.
|
@RulaKhaled I am currently doing a clean-up of stale draft PRs in the repo. Are you still working on this change? Would you like help to complete it? If not, please close the PR 🙏 |
This PR introduces a new silentLogs option that provides a middle ground between full verbose output and complete silence. When enabled, it suppresses verbose command output while still displaying essential feedback like success messages and error information.