Skip to content

ci: Add a new option silentLogs for cleaner CI/build output#2563

Closed
RulaKhaled wants to merge 2 commits intomasterfrom
new-silentLogs-command
Closed

ci: Add a new option silentLogs for cleaner CI/build output#2563
RulaKhaled wants to merge 2 commits intomasterfrom
new-silentLogs-command

Conversation

@RulaKhaled
Copy link
Copy Markdown

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.

const cli = new SentryCli('config', { silentLogs: true });
await cli.releases.new('v1.0.0');
// Output: "✓ Release v1.0.0 created"

await cli.sourcemaps.upload();  
// Output: "✓ Source maps uploaded"

@RulaKhaled RulaKhaled changed the title ci: Add a new option for cleaner CI/build output ci: Add a new option silentLogs for cleaner CI/build output Jun 20, 2025
@RulaKhaled RulaKhaled marked this pull request as ready for review June 23, 2025 11:34
Copy link
Copy Markdown
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

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]}`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[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
Comment on lines +436 to +440
case 'upload-dif':
return `✓ Debug information files uploaded`;

case 'upload-dsym':
return `✓ dSYM files uploaded`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These commands are both deprecated aliases of debug-files upload, so output should be the same

Suggested change
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
Comment on lines +448 to +452
case 'mobile-app':
if (args[1] === 'upload') {
return `✓ Mobile app uploaded`;
}
break;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's not add this yet, this command is still a work in progress.

Suggested change
case 'mobile-app':
if (args[1] === 'upload') {
return `✓ Mobile app uploaded`;
}
break;

js/helper.js Outdated
Comment on lines +460 to +461
case 'send-metric':
return `✓ Metric sent`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe not necessary to add this either, as metrics are deprecated, and will be rejected if users attempt to send them to Sentry SaaS

Suggested change
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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Suggested change
* @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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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 = {}) {
Copy link
Copy Markdown
Member

@szokeasaurusrex szokeasaurusrex Jun 23, 2025

Choose a reason for hiding this comment

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

Is this part of public API?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think users should only use the execute method provided by the SentryCli class

@RulaKhaled RulaKhaled force-pushed the new-silentLogs-command branch from d26527b to 4e33b73 Compare August 7, 2025 13:19
@RulaKhaled RulaKhaled requested a review from a team as a code owner August 7, 2025 13:19
@RulaKhaled RulaKhaled requested a review from sl0thentr0py August 7, 2025 13:19
} 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'];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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'.

Fix in Cursor Fix in Web

@RulaKhaled RulaKhaled marked this pull request as draft August 7, 2025 14:09
@szokeasaurusrex
Copy link
Copy Markdown
Member

@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 🙏

@szokeasaurusrex szokeasaurusrex removed the request for review from sl0thentr0py September 12, 2025 13:36
@RulaKhaled RulaKhaled closed this Sep 16, 2025
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 this pull request may close these issues.

2 participants