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?
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:
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:
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.