Build Filter not Working in Preview

I want to add a build filter with an ignored path for some backend assets and followed the docs at Blueprint Specification | Render and Monorepo Support | Render · Cloud Hosting for Developers as we have a monorepo with frontend and backend apps, but the build filter not only does not work and the backend is deployed every time the ignored files change, the frontend app is also deployed even though both have a rootDir setting.

My main problem for now though is why is the backend deployed when the files corresponding to its ignored paths change. Is it because the preview environment was already created, and therefore it will work for subsequent preview environments? If so, how would it work for the main application that also has an environment that is already created?

Hi @nicky,

When this happens, are all the changes in directories that are supposed to be ignored?

Or are you saying you commit a change in the frontend’s rootDir and both the frontend and backend are still deployed in the preview environment? If this is the case I believe that’s the expected behavior, the docs mention

Render will only create a Preview Environment if the files changed in a pull request match the Root Directory or Build Filter paths for at least one service.

So if at least one service sees changes, a preview environment is deployed. And preview environments include everything outlined in your render.yaml file.

I hope this helps clarify. Let me know if you still have any questions about this.

Matt

Thank you for the response.

When this happens, are all the changes in directories that are supposed to be ignored?

Yes, it happens when only a file that should be ignored is changed.

As for the rootDir and both services - we want both services to have preview environments created, but is it normal to have both deployed even when a change is made only to one of them?

Hi @nicky,

Thanks for clarifying. TL;DR - I think I’ve been able to reproduce the issue you’ve raised here and will have our Engineering team look into it. A few more details below. Let me know if what I’m describing matches what you’re experiencing.

Yes, it happens when a file that should be ignored is changed.

I’ve been able to reproduce this issue, where it seems build filters are not being respected for Preview Environments. I’ll send this to our engineering team to take a look into.

As for the rootDir and both services - we want both services to have preview environments created, but is it normal to have both deployed even when a change is made only to one of them?

I suspect this may be related to the other issue above. In my testing, this works as expected with the primary service, i.e. changes to the backend code only deploy the backend service. But does not work as expected in Preview Environments, i.e. changes to the backend code would deploy both the backend and frontend services. I’ll also have the team look into this.

Regards,

Matt

I see. Thank you very much for the response! It’s more important that it works in the primary service.

This might be of interest

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

We recently shipped a change that should fix this issue. RootDir and Build Filters should work as expected for PR Previews and Preview Envs.

1 Like