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] Incremental build should skip projects that succeed with warnings #1402

Open
1 of 2 tasks
WanderWang opened this issue Jul 19, 2019 · 9 comments
Open
1 of 2 tasks
Labels
enhancement The issue is asking for a new feature or design change needs design The next step is for someone to propose the details of an approach for solving the problem

Comments

@WanderWang
Copy link

WanderWang commented Jul 19, 2019

Is this a feature or a bug?

  • Feature
  • Bug

What is the expected behavior?

  1. create a project and add it to rush.json
  2. setup the script so that it prints a warning to STDERR (e.g. console.error("Warning!");)
  3. execute rush build,
  4. execute rush build again

Expected behavior: The project should be skipped the second time, since nothing has changed

Actual behavior: The project gets built a second time

@octogonz
Copy link
Collaborator

The logic is here: ProjectTask.ts#L94

From what I understand, the package-deps.json file will not be written if either (1) the process exit code is nonzero, or (2) if there is a "warning or error" (i.e. any output written to STDERR). Because the file is not written, rush build must redo the build the next time.

Here's why I think it was designed that way:

Imagine if warnings did not invalidate the build: Suppose that you run rush build, and it succeeds with some warnings. If you run rush build again, we'd like for it to skip all the projects (because nothing has changed). But it would be misleading for Rush to report 0 warnings. Ideally, Rush should somehow remember the warnings from the previous build, so it can show them the second time (without actually invoking the build scripts). At the very least, Rush needs to remember that there /were/ warnings, to prevent a CI build from accidentally succeeding when it should have failed.

How can we implement this? A simple idea would be for the package-deps.json file to track whether the build succeeded with warnings. Perhaps we could even save the STDERR content in that file.

Thoughts?

@nickpape @iclanton

@octogonz octogonz added the enhancement The issue is asking for a new feature or design change label Jul 19, 2019
@octogonz octogonz changed the title [rush] build project with warning should be skipped while rush build again without any change [rush] Incremental build should skip projects that succeed with warnings Jul 19, 2019
@rakeshpatnaik rakeshpatnaik added the needs design The next step is for someone to propose the details of an approach for solving the problem label Jul 29, 2019
@hardfist
Copy link

hardfist commented May 3, 2021

But we may need some escape hatch to skip the build cache invalidate for warning build, since we may know that some tools write to stderr not for warnings(esbuild for example, use stderr to print info instead of stdout, because it already use stdout for pipe communication evanw/esbuild#1024)

@Measy
Copy link

Measy commented Jun 3, 2021

The logic is here: ProjectTask.ts#L94

From what I understand, the package-deps.json file will not be written if either (1) the process exit code is nonzero, or (2) if there is a "warning or error" (i.e. any output written to STDERR). Because the file is not written, rush build must redo the build the next time.

Here's why I think it was designed that way:

Imagine if warnings did not invalidate the build: Suppose that you run rush build, and it succeeds with some warnings. If you run rush build again, we'd like for it to skip all the projects (because nothing has changed). But it would be misleading for Rush to report 0 warnings. Ideally, Rush should somehow remember the warnings from the previous build, so it can show them the second time (without actually invoking the build scripts). At the very least, Rush needs to remember that there /were/ warnings, to prevent a CI build from accidentally succeeding when it should have failed.

How can we implement this? A simple idea would be for the package-deps.json file to track whether the build succeeded with warnings. Perhaps we could even save the STDERR content in that file.

Thoughts?

@nickpape @iclanton

So will you eventually provide this as you mentioned? such as 'allowWarningsCache' that make package-deps.json file to track whether the build succeeded with warnings. And save the STDERR content in that file while next build to remember the warnings;

@TheBit
Copy link

TheBit commented Nov 3, 2021

@Measy this might be interesting to you

@BorysShulyak
Copy link

any news on this?

@alber70g
Copy link

alber70g commented Feb 2, 2022

Any advancement on this. It's very annoying to rebuild projects that only had warnings. The allowWarningsInSuccessfulBuild should be enough to skip rebuilding, but an extra flag like allowBuildsWithWarningsToBeCached could work as well.

We're adopting the api-extractor, and that gives a bunch of warnings, that we want to have, but not be blocking and increasing build times

@alber70g
Copy link

alber70g commented Feb 2, 2022

I just looked at the source (the path mentioned here is not up-to-date?)

https://github.com/microsoft/rushstack/blob/master/apps/rush-lib/src/logic/taskExecution/ProjectTaskRunner.ts#L356-L357

It seems there's an experimental flag? this._rushConfiguration.experimentsConfiguration.configuration .buildCacheWithAllowWarningsInSuccessfulBuild

@alber70g
Copy link

alber70g commented Feb 2, 2022

Oh well, there's a flag. Go to common/config/rush/experiments.json and enable buildCacheWithAllowWarningsInSuccessfulBuild

See also the config source

@ajmeese7
Copy link

@alber70g I enabled that flag and I'm still having the same problem. I went ahead and changed my Babel config to supress the warning, but the flag itself did not fix the issue. Is there something that I am missing? Just curious in case I encounter this problem again.

@github-project-automation github-project-automation bot moved this to Needs triage in Bug Triage Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is asking for a new feature or design change needs design The next step is for someone to propose the details of an approach for solving the problem
Projects
Status: Needs triage
Development

No branches or pull requests

9 participants