Inconsistent ignoring builds in Monorepo

I’ve tried to follow the many different examples in ignoring builds based on changes to certain folders and I don’t seem to be able to create a consistent experience.

It sometimes cancels correctly, sometimes doesn’t and I can’t figure out whats is causing either of them.

Some context we are a Design System monorepo and the root directory is the root of the repo because we use the latest local versions of packages to build our assets with.

What I want to be able to do is say “only do a preview deploy when we have changes in two directories that are different than in the main branch”. I have tried different combinations of the following.

  # only do a preview Preformatted text deply when there is a website change
  ignore = "git diff --quiet main HEAD -- packages/paste-website packages/paste-theme-designer"

I’ve tried git diff --quiet HEAD^ HEAD sub_dir/ from this page File-based configuration | Netlify Docs and the blog How to Ignore Builds - Optimize your Netlify Build Times. Neither work successfully all the time. Sometimes it’s successful in detecting that there was no changes and cancels the builds, other times it just builds a deplopyment regardless

What am I doing wrong?

Hey there, @SiTaggart :wave:

Thanks for reaching out, and welcome to the Netlify Forums :netliconfetti:

It looks like this thread has been a bit quiet since you last posted. Are you still encountering this issue? If so, please share your Netlify site name, as well as any additional debugging steps have you taken this past week?

i’m running into this issue with monorepo as well, i am surprised netlify is not implementing the clear cache and deploy correctly. or at least useful to those who are using monorepo. it is a pain in the ass and there is no workaround. it is simply bugged.

not only the variable is weird as mentioned in the other thread: I'd like to force a build even if the ignore command would cancel the build

I also observe that if you push two sites that share the same folder but have different configuration (ENV) the first one who finishes the deploy will succeed while the other one will fail it is almost as if those two sites share the same var when they shouldn’t (as the var for each deploy history is different but somehow they share, this is definitely a bug). I’m also surprised that this issue is still existing after almost a year later.

We’ll be happy to help you troubleshoot why the deploys work differently if you’d like to link us to those two sites. I’d suggest starting a different thread for this separate problem.

In the good news department, Netlify is actively working on our monorepo support (here’s the most recent release from that team: How to use pnpm with Netlify Build | Netlify Blog ) so if you’d like to help us understand better what you are struggling to get working specifically with the monorepo, it is possible we’ll be working towards a fix or can help you work around it.

Forcing a build even if the command would prevent is not an intended feature of our platform; so you’d need to write your ignore command better to prevent this block and I’m sure that is possible today if you use a custom ignore command, so happy to work with you on your specific situation there, which I assume is not the main problem you are talking about around clearing cache not working as you desire?

Thanks for helping us understand all the things you are struggling with so we can try to help you find fixes.

As I mentioned above, I’d start separate threads for each situation - maybe this thread is just for the ignore script, and you can start different ones for the environment variables and the two sites’ builds?