-
Notifications
You must be signed in to change notification settings - Fork 598
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
[rush] Rush returns a zero exit code when build succeeds with warnings. #1329
Comments
To address this issue, we've added a property called When invoking shell scripts, Rush uses a heuristic to distinguish errors from warnings:
Thus, warnings do not interfere with local development, but they will cause a CI job to fail, because the Rush process itself returns a nonzero exit code if there are any warnings or errors. This is by design. In an active monorepo, we've found that if you allow any warnings in your master branch, it inadvertently teaches developers to ignore warnings, which quickly leads to a situation where so many "expected" warnings have accumulated that warnings no longer serve any useful purpose. Sometimes a poorly behaved task will write output to stderr even though its operation was successful. In that case, it's strongly recommended to fix the task. However, as a workaround you can set allowWarningsInSuccessfulBuild=true, which causes Rush to return a nonzero exit code for errors only. Note: The default value is false. In Rush 5.7.x and earlier, the default value was true. |
How can I set {
"commandKind": "bulk",
"name": "rebuild",
"allowWarningsInSuccessfulBuild": true
} But that is rejected by schema validation:
|
😯 You would need to provide a complete command definition to pass schema validation. In other words, if you specify The solution would look like this: {
"commandKind": "bulk",
"name": "build",
"summary": "Build all projects that haven't been built, or have changed since they were last built",
"description": "This command is similar to \"rush rebuild\", except that \"rush build\" performs...",
"safeForSimultaneousRushProcesses": false,
"enableParallelism": true,
"ignoreDependencyOrder": false,
"ignoreMissingScript": false,
"allowWarningsInSuccessfulBuild": true
},
{
"commandKind": "bulk",
"name": "rebuild",
"summary": "Clean and rebuild the entire set of projects",
"description": "This command assumes that the package.json file for each project contains...",
"safeForSimultaneousRushProcesses": false,
"enableParallelism": true,
"ignoreDependencyOrder": false,
"ignoreMissingScript": false,
"allowWarningsInSuccessfulBuild": true
}, @iclanton this is... not a very good user experience. I feel like it's a gap we overlooked in the design of the A simple solution would be to add a special option for the built-in |
Yes I hoped the default settings for @octogonz I don't understand how the configuration you propose would enable the default rush behavior with respect to
|
@Toxaris today We want to generalize the incremental build concept to support custom commands as well. This is a deep topic. You'll find a number of Rush issues that propose parts of a design. This year we're hoping to integrate all those pieces together into major new feature focused around faster builds for large repos. |
Just hit this as well. One thing to add is that when implementing the {
...snip...
"scripts": {
"build": "...some build steps...", // whatever your normal build steps are
"rebuild": "npm run build" // <- run the regular build task above when calling rebuild
}
...snip...
} Also, @octogonz, after adding the commands above, should we expect the "non-incremental" part of Edit: Just tested it, and it's working fine -- it appears to still be doing a full rebuild, even if some projects have already been built successfully. |
This issue is closed, so the discussion here won't be tracked by anybody. If there isn't already another GitHub issue tracking this topic, please open one. Thanks! |
What about |
修复因 jest 使用 stderr 输出警告而导致的 CI 执行失败 microsoft/rushstack#1329
修复因 jest 使用 stderr 输出警告而导致的 CI 执行失败 microsoft/rushstack#1329
修复因 jest 使用 stderr 输出警告而导致的 CI 执行失败 microsoft/rushstack#1329
修复因 jest 使用 stderr 输出警告而导致的 CI 执行失败 microsoft/rushstack#1329
修复因 jest 使用 stderr 输出警告而导致的 CI 执行失败 microsoft/rushstack#1329
修复因 jest 使用 stderr 输出警告而导致的 CI 执行失败 microsoft/rushstack#1329
修复因 jest 使用 stderr 输出警告而导致的 CI 执行失败 microsoft/rushstack#1329
修复因 jest 使用 stderr 输出警告而导致的 CI 执行失败 microsoft/rushstack#1329
修复因 jest 使用 stderr 输出警告而导致的 CI 执行失败 microsoft/rushstack#1329
修复因 jest 使用 stderr 输出警告而导致的 CI 执行失败 microsoft/rushstack#1329
WorkaroundAdd |
This completely breaks the build since vue-cli outputs standard informational logging to the stderr. using the |
Hey @DmacMcgreg this issue is old and there are new features in place to solve it properly in recent versions of Rush. "commands": [
{
"name": "build",
"commandKind": "bulk",
"summary": "Build all projects that haven't been built, or have changed since they were last built",
"incremental": true,
"enableParallelism": true,
"allowWarningsInSuccessfulBuild": true
},
{
"name": "rebuild",
"commandKind": "bulk",
"summary": "Rebuild all projects",
"incremental": false,
"enableParallelism": true,
"allowWarningsInSuccessfulBuild": true
}
] By default, build/rebuild will fail if anything is outputted to stderr ( I hope this solves your issue |
@isc30 That then requires a rebuild script for every package.json in the repo. How is this considered a solution? |
@aDavidaIsNoOne if you only need |
change `test` script from `jest` to `jest 2>&1` microsoft/rushstack#1329 (comment)
change `test` script from `jest` to `jest 2>&1` microsoft/rushstack#1329 (comment)
@isc30 You mention there are new features in place in newer versions of rush to solve it. Can you elaborate? I can't find any mention of this in the docs, other than patching the libraries that write to stdout. :) Would be great to not have to "overwrite" the build command just to add the flag. |
Hey, when I said that the issue was old I meant that at that time you
couldn't mark warnings as success. Now you can by redefining build and
rebuild commands to pass with warnings (not ideal but works). Sorry for the
confusion
|
Apologies for adding a comment to an old and closed issue, but might be good to add opinions on this matter so that other people can better judge their own situation (I ranted before about this in kadena-community/kadena.js#442 (comment)). Imho, I believe making this behavior in Rush the default was the wrong solution for a problem most projects don't have, causing confusion instead. The upside is that I learned a lot about going against well-established standards. Recently a developer joining our team wasted a lot of time wondering why his I know we can change the default setting. Just making the case here that it's a very poor one. We should rely on the process exit code for successful operations. That's it. Just like everyone else. Principle of least astonishment. |
I can't believe they just closed this and never looked back heh. |
Rush is supposed to return a nonzero exit code when a project succeeds with warnings. As per documentation:
However, Rush currently returns a zero exit code after reporting a warning. It seems like this has been broken for a while, so any fix should be gated behind an option to ignore warnings.
The text was updated successfully, but these errors were encountered: