Home
Support Forums

Deploy previews are cancelling too aggressively

We are trying to get deploy previews working but there’s a weird bug that we can’t seem to get around now.

System details:

  • mono repo with front-end/back-end folders
  • back-end folder is deployed to Heroku (RoR)
  • front-end folder is deployed to Netlify (React/Typescript)

Right now when we make a pull request if there are no front end changes it cancels the deploy preview. This leaves us without a usable environment for the pull request. Is there a way to turn off the checking if there are changes so that it always pushes if it’s the first deployment in a pr?

Hi there, @mikecousins :wave:

Thanks for reaching out. Sorry to hear you are encountering an issue. There is a way to disable git commit checks and statuses-- you can check the docs here. Is this what you are looking for?

I am curious about what you are encountering. It would be beneficial if you could include your Netlify site name as well as a screenshot of the error in your response, if you are able to.

Thank you!

Site name is gofreddie-staging.

It’s not the commit check or status, the actual deploy preview gets cancelled and doesn’t deploy. I submitted a support ticket as well and they said to look into the build → ignore field in a netlify.toml file. I tried that but it doesn’t seem to be detecting the changes properly.

2:02:09 PM: Build ready to start
2:02:11 PM: build-image version: 0582042f4fc261adc7bd8333f34884959c577302
2:02:11 PM: build-image tag: v3.7.6
2:02:11 PM: buildbot version: 03c6f9d243f25556225c9548fcb276f97b8bf623
2:02:11 PM: Fetching cached dependencies
2:02:11 PM: Starting to download cache of 2.4GB
2:02:25 PM: Finished downloading cache in 14.46362013s
2:02:25 PM: Starting to extract cache
2:04:04 PM: Finished extracting cache in 1m38.893502384s
2:04:05 PM: Finished fetching cache in 1m53.622425804s
2:04:05 PM: Starting to prepare the repo for build
2:04:05 PM: Preparing Git Reference pull/1155/head
2:04:08 PM: Parsing package.json dependencies
2:04:09 PM: Different publish path detected, going to use the one specified in the Netlify configuration 
file: 'front-end/build' versus 'build' in the Netlify UI
2:04:09 PM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: 'git diff --quiet $COMMIT_REF $CACHED_COMMIT_REF -- front-end/ back-end/'
2:04:09 PM: User-specified ignore command returned exit code 0. Returning early from build.
2:04:09 PM: Creating deploy upload records
2:04:09 PM: Failed during stage 'checking build content for changes': Canceled build due to no content change
2:04:09 PM: Finished processing build request in 1m58.112815633s

I want this deploy preview to always deploy whether there is a change in the front-end folder OR the back-end folder.

Hey @mikecousins ,

Sorry to be slow to get back to you. Did you check out this guide? Lots of customisation and options to build, or not build!

Just to follow up on this I eventually fixed it with this:

[build]
  ignore = "git diff --quiet $COMMIT_REF $CACHED_COMMIT_REF -- ../front-end/ ../back-end/"

It causes another bug though in that I can’t redeploy sites anymore because this check fails.

Hi, @mikecousins. It sounds like you want to always deploy when there is a deploy preview. Is that correct?

If so, you can ignore the build.ignore like so:

[context.deploy-preview]
  ignore = "false"

Would you be willing to test that out? It should completely skip the change test for deploy previews and always build if that is the deploy context at Netlify.