How to manage dependencies in a shared git subtree?

57 views Asked by At

Lets say I have four git repos named A,B,C, & D

  • A,B, & C (customer repos):
    • Each repo contains a Django project for customers 1, 2, & 3 respectively

    • Each customer exists in an air gapped environment

    • From a user perspective, each of the Django projects are, more or less, functionally the same

    • The repos have similar dependencies, although, they may vary in their versions (Django 2.x vs Django 4.x, PostgreSQL 13 vs 14, PostgreSQL vs SQLite, python package versions, etc.)

  • D (common repo):
    • This repo contains the code (Django apps & utilities) that is common across the customer repos

    • This repo has been added as a git subtree to each of the customer repos

The problem occurs when their is a dependency clash between the code in the customer repos and the common repo. For instance, if there was a line of code in the common repo that relies on Django 4.x and repo A depends on Django 2.x, then there will be errors. This same type of problem may occur with other dependencies.

I've thought of two "solutions":

  1. Converge towards a single set of dependencies for all repos. In order to get this to work, however, each customer will be forced to update their dependencies. Since each customer exists in an air gapped environment, they are reluctant to do this as it would require a lot of effort on their part. From what I've heard they follow a "if it ain't broke don't fix it" mentality

  2. If there is a dependency clash, remove the code from the common repo and move to each of the customer repos . However, I don't like this solution as every time there is an update to this part of the code I'll have to implement it in each of the customer repos.

Is there a better way of handling this?

0

There are 0 answers