Reputation: 949
I have a few custom-written packages, residing in their separate projects on my private GitLab server. A new project I am working on now will make use of some of these custom-written packages as its dependencies. If I were to visualize the file structure, it would be like so:
GitLab
|
|-- Old_project_1 -- package_1
|
|-- Old_project_2 -- package_2
|
|-- Current_project (dependencies: package_1, package_2)
I do not want to copy packages 1&2 into the Current_project folder, because then if I make some changes to them, it will not be mirrored in their master branches in Old_project_1/2 folders. It would also attract the need to manually update them later on, which just doubles up on workload.
Does GitLab support some sort of linking mechanism, which would allow me to integrate package_1/2 in the Current_project's folder, without all the manual copying?
I figure this is an elementary question, but after briefly scrolling through GitLab's tutorial, I couldn`t easily find this functionality.
Upvotes: 0
Views: 42
Reputation: 83527
This is most properly solved by using your language's package management tools. For example, with Python's pip
, you typically create a requirements.txt
file that lists the package dependencies of the project. For third-party packages, these dependencies usually refer to a repository such as PyPi. However, pip
also supports syntax to declare a dependency as a Git repository.
You will need to properly package each project so that it can be consumed with pip. This involves writing a little bit of code that uses buildtools
to define how the package should be built. Then in your "current project", you can add both "old projects" to the requirements.txt
and specify that they are located in a git repository. I suggest you learn about the package management tools for your language and use those to full effect here.
Upvotes: 1