Build canceled due to no content change when using submodule

I’ve run into a hopefully relatively simple issue that I need some help with. I have a git submodule in my repository used to generate my website (through a docusaurus build). The build worked perfectly the first time, but when I pushed a commit with no changes except for updating the submodule, I received the following message in the deployment log

6:38:28 PM: No changes detected in base directory. Returning early from build.
6:38:28 PM: Failed during stage 'checking build content for changes': Canceled build due to no content change

I’ve seen various references to configuring netlify to ignore builds unless some subset of the files has changed, but in my case a build is being ignored despite the fact that my git submodule has been updated.

Site Name: https://hopeful-rosalind-235059.netlify.app

Thanks!
Harry

Hi, @hkalodner, when only the submodule changes the default git diff build ignore command is returning a zero exit code (no difference = 0, difference = 1).

There is more documentation about this here:

https://docs.netlify.com/configure-builds/file-based-configuration/#ignore-builds

You can add a netlify.toml file to the base of the repo with a build.ignore setting to always force a build like so:

[build]
  ignore = "false"

The value of “false” is actually the name of a command and the manual page for false is below:

FALSE(1)            User Commands            FALSE(1)
NAME
       false - do nothing, unsuccessfully

SYNOPSIS
       false [ignored command line arguments]
       false OPTION

DESCRIPTION
       Exit with a status code indicating failure.

The build ignore command only builds when the command exist with a non-zero exit code. The command false always returns a non-zero exit code. So, using false as the build.ignore command will mean the build image will always build, even if nothing changes in the primary repo.

If there are other questions, please let us know.

Thanks so much, this was incredibly helpful!

1 Like