Disable auto building when creating and editing MRs

Let’s say I go to Gitlab and

  1. create a MR
  2. edit the MR’s description
  3. push some commits to the MR branch

The problem is that a build is generated and deployed for each of the three steps. 1. and 2. are obviously identical to master, and therefore their builds are a waste of, well, build time. On the other hand, I do want netlify to build deploy previews when I push to the MR’s branch. How can I achieve this?

Two fairly simple possibilities:

  1. put [skip ci] in the commit message for such commits
  2. or use the build.ignore script to tell us when not to build. See this thread for more info on how that works with some examples: [Common Issue] How can I optimize my Netlify build time?

Thank you @fool, but only step 3. includes actual commits (and I do want netlify to make a build there!). Please refer to the thread you linked me to, [Common Issue] How can I optimize my Netlify build time?. I’ve added a screenshot there that may clarify things.

@LGenzelis, I believe this behavior is because of the MR webhook behavior at GitLab itself. I’m looking at one of my sites with a repo hosted at GitLab and I see the following there:

The highlighted text reads:

This URL will be triggered when a merge request is created/updated/merged

We cannot differentiate between created, update, and merge for MRs because GitLab’s webhook settings don’t have fine grained options for this. It is “all or nothing”.

Are you running a build in a different CI/CD system? If so, it is possible to deploy the files directly from the other build system using Netlify CLI:

https://docs.netlify.com/cli/get-started/#draft-and-production-deploys

This completely by-passes the build at Netlify and directly uploads the files from the other CI/CD system to Netlify.

If there are other questions about this, please let us know.

Thank you @luke. I will try to find a workaround, then.