I’ve been having a bunch of difficulties trying to get builds to only run when a certain subset of folders have changed. I thought I finally got things in a working condition but today I’m seeing a build that should be running is actually canceling early.
I’m working with a monorepo so in order to reduce our build times I’ve created an ignore script to only check for the particular folders that we care about. I’ve got a dummy directory for Netlify (
.netlify-dummy-dir) that we target as the build directory.
We specify an ignore script (netlify-ignore.sh) file looks like this:
(Separate note: we found that we were unable to do
cd .. && git diff --quiet as a single command in our TOML file and that’s why we created a separate bash script to run)
Here is a build log that should be building but is instead canceling early:
1:26:25 PM: Build ready to start 1:26:27 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6 1:26:27 PM: build-image tag: v3.4.1 1:26:27 PM: buildbot version: 648208d76731cd5bca75c1e9bc99d2032a1f1473 1:26:27 PM: Fetching cached dependencies 1:26:27 PM: Starting to download cache of 609.3MB 1:26:31 PM: Finished downloading cache in 4.203288656s 1:26:31 PM: Starting to extract cache 1:26:43 PM: Finished extracting cache in 12.030958208s 1:26:43 PM: Finished fetching cache in 16.589045472s 1:26:43 PM: Starting to prepare the repo for build 1:26:44 PM: Preparing Git Reference pull/17694/head 1:26:52 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: '.netlify-dummy-dir' versus '' in the Netlify UI 1:26:52 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: '.netlify-dummy-dir/.storybook-build' versus '' in the Netlify UI 1:26:52 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'cd .. ; yarn ; yarn storybook:build --quiet' versus '' in the Netlify UI 1:26:52 PM: Detected ignore command in Netlify configuration file. Proceeding with the specified command: 'sh ../netlify-ignore.sh' 1:26:52 PM: User-specified ignore command returned exit code 0. Returning early from build. 1:26:52 PM: Failed during stage 'checking build content for changes': Canceled build due to no content change 1:26:52 PM: Finished processing build request in 25.536267909s
There are changes on this branch in the
git diff --quiet command. When I run the command locally (running
git diff master HEAD) I can see the changes are there.
Is there any extra step that I’m missing? Is there an easy way to debug this? Due to company confidentiality I cannot provide the site name but perhaps this redacted build URL can help:
Any help would be greatly appreciated!