Check for missing LFS objects post-receive for large pushes
Checking for missing LFS objects is slow and currently causing frequent timeouts. We can probably make it faster, but the pattern doesn't scale as nicely expressed by @jacobvosmaer-gitlab https://gitlab.com/gitlab-org/gitlab-ee/issues/3429#note_57801964:
I think the concept of push rules is problematic. They are about forbidding certain objects to be pushed. A push can contain an arbitrary amount of objects, so we are forced to inspect an arbitrary amount of objects while the user waits for the push to succeed.
From a feature standpoint it defeats the purpose of the push rule if we only check the first N commits, because then a user can (intentionally or accidentally) hide their 'bad' commit in a very large push.
Proposal
- Based on number of number of files, commits and other heuristics, for small pushes check for missing LFS objects pre-recieve
- For all other pushes:
- skip the pre-recieve check
- check for missing files post-recieve
- notify users of failed check with a status badge on the commit and an email notification
In a merge request;
- if the head of the branch being merged is missing an LFS object, show an error
- if a non-head commit in the branch being merged is missing an LFS object, show a warning