Home
Support Forums

I'd like to force a build even if the ignore command would cancel the build

Hi,

We have a complex monorepo setup and we have been using the ignore command which works fine most of the time. But sometimes it cancels the build when it shouldn’t. The
reason isn’t clear, force push / new branch, no previous build, commit diff isn’t correct, I don’t know.

But it is quite annoying. (need to remove the ignore command, then make a build, then put it back)

Our check is simple git diff --quiet "${CACHED_COMMIT_REF}" "${COMMIT_REF}" some_folders

One thing that would help to figure out what’s going on is logging CACHED_COMMIT_REF and COMMIT_REF. Because maybe these aren’t the expected ones.

That said, it would be even easier if we could force a build as a last resort when the build is canceled for no apparent reason.

hi there @AoDev - that sounds vey frustrating!

I just saw this:

is this the same behaviour? if yes, then it sounds like we might have a bug on our hands.

It looks similar. The other user also has the same troubles, not knowing what’s happening. So we can’t really act.

That’s why I asked about logging the 2 commits variables used for the diff. Actually, it would be nice to log all env variables of Netlify that may influence a build right at the beginning. (excluding possible sensitive ones)

For example, if a build fails, what commits will be used for the diff. Or if I force push on git, what is the value of CACHED_COMMIT_REF and COMMIT_REF?

Another thing is, I had to make a change in the Netlify config for a site (deployment settings) because it was an old branch not taking into account the new build process and the build failed. The problem is then the only way to trigger a build is to send a dummy commit and even that didn’t work in one situation.
So, that’s why I made this feature request. It is hard to debug and get the perfect behaviour.

Just now I had this issue. The scenario is the following:

branch Master is more advanced.
branch Random is out of sync.

git hard reset of Random to equal Master
git force push Random

build ignored.

Hey there! Appreciate the feature req.

That’s why I asked about logging the 2 commits variables used for the diff

Whilst debugging, you can always update your build command to be echo $[var] && [build command]?

@Scott @perry I can give you another scenario I had 5 minutes ago.

I added a new site from the repo that has an ignore build command.
Once configured and clicked “deploy site” to finalize the process, I got the error

Reason: build was ignored. And I can’t force it to deploy.
Would really love to have a “force build” button.

Appreciate the feedback! For the time-being, the workaround would be to add the ignore build command post first deploy.

I mentioned above that we have a monorepo. So the command is already there when we create a new site. And sometimes the ignore check needs to be removed then readded.

New case, canceled because no changes in base directory:

We have

/packages/A
/packages/common

site A has base directory in packages/A

A imports stuff from common. Something is modified in common but nothing in A.
Site A build is canceled because no change in base directory.

What if you set the base directory to ‘packages’ and run ‘cd A && [build command]’?

Then we wouldn’t be able to have netlify.toml per app. I dont think it’s really relevant to this feature request to be honest. I have mentioned a couple of scenarios where the build is ignored.

There are always edge cases or simply no time to make this perfect. Thus having a “force build” makes sense and should be pretty simple to implement on Netlify’ side.

Actually I was expecting the “clear cache and deploy” option to solve the issue but it does not.