Our GitLab instance is free tier meaning we have no access to group templates and so on. So I decided to create a repository that will contain
- documentation on the process of creating/modifying templates
- a branch that offers a generic construct, that all templates need to be derived from
- X branches each representing a project template that a developer can simply clone and start doing their own thing
In terms of git structure I currently have:
.
|
+ -- master
|
+ -- template_generic
|
+ -- template_1
|
+ -- template_2
.
.
.
+ -- template_N
where
master
contains theREADME
file, where all processes related to the repo are describedtemplate_generic
contains two files namelytemplate.md
andLICENSE
with the first providing a generic documentation description (with place holders such as title, description, usage, changelog, examples etc.) and latter - licensing informationtemplate_X
contains the building blocks (code snippets, environment setup etc.) for a project that fits its description. Usually derived fromtemplate_generic
but can also be derived from multiple othertemplate_X
branches if those are a requirement for a larger template setup.
Example:
If I want to write a PySide2 project using UI files I will take the template_pyside2_with_ui_file
as my starting point and develop from there.
If I want to write an OpenCV C++ application with CMake I will take the template_opencv_c++_with_cmake
as my starting point and develop from there.
Since we have problems documenting stuff (consistency, tracking changes etc.) I am trying to "enforce" this in a more gentle way where a person is offered the frame of a document describing what the template does inside the template.md
file and just needs to follow it.
GitLab offers project wiki, which is very nice way to gather information together and - the most important thing - search through it. I have made a requirement that every template needs to have a Wiki page entry. And this is what the template.md
is for (at least I hope).
My idea is as follows:
- Whenever a developer wants to create a new template they need to fork the main repo, create their own
template_X
branch (derived fromtemplate_generic
) and create a merge request labeled asnew template
. Upon successful merging (successful is defined as a request approved, merged and closed) a new branch in the Wiki repo will be created with the same nametemplate_X
and will contain just thetemplate.md
file. The branch will create a new page in the Wiki displaying the contents of that file - Whenever a developer want to modify an existing template they need to fork the main repo, modify the
template_X
branch and create a merge request labeled aschange template
. Upon successful merging the respective branch in the Wiki repo will be modified and the page will display the updated contents oftemplate.md
. - Limited upstream push for the wiki meaning no one will be able to push to the repository and the only updates to it will happen directly from changes in the code repository. The wiki repo can thus be qualified (in a way) as a partial mirror repository for the code repository with a branches being protected. This will ensure the absence of discrepancies between the two repositories, which otherwise may occur if people can edit contents in both. If someone wants to change a wiki page, they need to fork, modify the
template.md
and submit a merge request to the code repository.
If we take the git structure I mentioned before we will have
(code repo) (wiki repo)
. .
| |
+ -- master + -- master
| |
+ -- template_generic + -- template_1
| |
+ -- template_1 + -- template_2
| .
+ -- template_2 .
. .
. + -- template_N
.
+ -- template_N
My question is if this is possible and if yes, how would one achieve it (again - we have the free tier of GitLab)? I am a GitLab noob.