Summary: How can my team manage merge requests in GitLab to prevent a binary file from ever going "back in time"?
Details of the actual root need, to avoid an XY problem.
I'm helping with infrastructure for a team that's ~10 developers and growing quickly. The project requires certain binary files to be used as ~source that's paired with code, including .xlsx
files. We are trying to establish processes and configurations that ~prevent a developer resolving a merge conflict in these files from running over someone else's changes.
Below is the process we've come up with, but there's a race condition in this process. How can we get git/GitLab to prevent this race condition?
main
, and fails if the merge would create an earlier timestamp.main
are using v5 of the file.6 >= 5
and the pipeline passes.7 >= 5
and the pipeline passes.main
.main
…destroying v7. GitLab does not prevent this, because CI/CD only runs when the merge request is created or the source branch updated, not when the merge finally happens.Our GitLab instance is self-hosted, but the company will not allow server-side hooks to run on it. We cannot use a pre-receive hook to prevent the second merge from succeeding.
Changes to the source asset require paired code changes. Modifying the asset and pushing it to main without modifying other code will break the codebase.
The process of developing the code for a change can be days long. Even if we had some process to set an exclusive lock, we cannot afford to prevent anyone from changing or working on the source file until one developer's MR is finally merged.
We have looked deeply into removing binary files as source assets to the greatest extent possible, and breaking them down into the smallest reasonable pieces when they must be binary. Please assume the requirement stands that some assets must remain ~undiffable binary.
If our CI/CD could look across all open MRs, it could fail whenever another MR is open that has a later version than the current MR. That would catch the case where developer A submitted their v6
MR after developer B's v7
MR was created (but not yet merged). Not sure if this would be possible?