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

[rush] build-cache ignores allowWarningsInSuccessfulBuild #2803

Closed
relm923 opened this issue Jul 9, 2021 · 8 comments · Fixed by #2835
Closed

[rush] build-cache ignores allowWarningsInSuccessfulBuild #2803

relm923 opened this issue Jul 9, 2021 · 8 comments · Fixed by #2835
Labels
bug Something isn't working as intended help wanted If you're looking to contribute, this issue is a good place to start!

Comments

@relm923
Copy link
Contributor

relm923 commented Jul 9, 2021

Summary

The new build-cache system does not write to the cache when the command writes to STDERR even when allowWarningsInSuccessfulBuild: true is used in the command config.

This is easiest to see when running rush test and using jest since Jest regularly writes to STDERR (jestjs/jest#5064). But will occur with any command that writes to STDERR

I would expect the build-cache logic to respect the allowWarningsInSuccessfulBuild so we can still take advantage of caching even when third parties use STDERR incorrectly.

Repro steps

Add global command that triggers something to write to STDERR

// command-line.json
{
  "name": "test",
  "commandKind": "bulk",
  "summary": "This command invokes Jest to test apps.",
  "safeForSimultaneousRushProcesses": true,
  "allowWarningsInSuccessfulBuild": true,
  "incremental": true,
  "enableParallelism": true
},

// package.json
"scripts": {
  "test": "jest"
},

Expected result:

  1. Run command rush test. No cache hits - all tests run (printing warnings) and cache is updated
  2. Run command rush test again. All cache hits - no tests run

Actual result:

  1. Run command rush test. No cache hits - all tests run (printing warnings) and cache is NOT updated
  2. Run command rush test again. No cache hits - all tests run (printing warnings) and cache is NOT updated

Details

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? 5.47.0
rushVersion from rush.json? 5.47.0
useWorkspaces from rush.json? true
Operating system? Mac
Would you consider contributing a PR? Yes
Node.js version (node -v)? v16.3.0
@relm923
Copy link
Contributor Author

relm923 commented Jul 9, 2021

I'm not very familiar with this logic but it seems like

} else if (hasWarningOrError) {
needs to updated to respect allowWarningsInSuccessfulBuild

@octogonz octogonz added bug Something isn't working as intended help wanted If you're looking to contribute, this issue is a good place to start! labels Jul 13, 2021
@octogonz
Copy link
Collaborator

I would expect the build-cache logic to respect the allowWarningsInSuccessfulBuild so we can still take advantage of caching even when third parties use STDERR incorrectly.

Agreed, this seems like a bug.

@iclanton

@Measy
Copy link

Measy commented Jul 21, 2021

It seems related #1402

@relm923
Copy link
Contributor Author

relm923 commented Jul 26, 2021

@octogonz @iclanton any update on this?

I'm happy to help contribute a fix but will likely need some guidance getting started

@F3n67u
Copy link
Contributor

F3n67u commented Jul 30, 2021

@relm923 Try let this if also pass when allowWarningsInSuccessfulBuild & status === TaskStatus.SuccessWithWarning is true.

if (status === TaskStatus.Success && projectBuildDeps) {

@F3n67u
Copy link
Contributor

F3n67u commented Jul 30, 2021

I have encountered the same issue.

@octogonz
Copy link
Collaborator

I'm happy to help contribute a fix but will likely need some guidance getting started

That would be great! If you have questions about the approach, #contributor-helpline is the quickest way to get unblocked.

@relm923
Copy link
Contributor Author

relm923 commented Jul 31, 2021

@octogonz took a stab at a PR (#2835) let me know what you think

@iclanton iclanton moved this to Closed in Bug Triage Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended help wanted If you're looking to contribute, this issue is a good place to start!
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants