GitLab-通过在代码存储库中跟踪特定文件来自动管理存储库Wiki页面?
我们的gitlab实例是免费的层,这意味着我们无法访问组模板等。因此,我决定创建一个存储库,该存储库将包含有关
- 创建/修改模板的过程的文档
- ,该分支提供了一个通用构造的分支,所有模板都需要从
- x分支中衍生出每个模板,每个模板每个代表一个项目模板,开发人员可以简单地启动并启动该模板 来做自己的事情
我当前拥有自己的git结构
.
|
+ -- master
|
+ -- template_generic
|
+ -- template_1
|
+ -- template_2
.
.
.
+ -- template_N
:其中
master
包含readme
file,其中与repo相关的所有进程均已描述template_generic
template_generic 包含两个文件,即template.md
和许可
首先提供通用文档描述(带有诸如 title ,的位置持有人描述,用法, changelog ,示例等)和后者 - 许可信息template_x
包含适合其描述的项目的构建块(代码段,环境设置等)。通常从template_generic
派生,但也可以从多个其他template_x
分支派生,如果这些分支是对较大的模板设置的要求。
示例:
如果我想使用UI文件编写一个Pyside2项目,我将使用template_pyside2_with_ui_file
作为我的起点并从那里开发。
如果我想用cmake编写一个OpenCV C ++应用程序,我将以template_opencv_c ++ _使用_CMAKE
作为我的起点,然后从那里开始开发。
由于我们在记录内容(一致性,跟踪更改等)时遇到问题,因此我试图以更柔和的方式“执行”此操作,以提供一个人的文档框架,描述了模板在template.md.md中所做的内容
文件,只需遵循它即可。
GitLab提供Wiki项目,这是将信息聚集在一起的非常好的方式,并且 - 最重要的事情 - 搜索它。我要求每个模板都需要具有Wiki页面条目。这就是template.md
的目的(至少我希望)。
我的想法如下:
- 每当开发人员想要创建一个新的模板时,他们需要分配主仓库,创建自己的
template_x
branch(源自template_generic < /code>)并创建标记为
新模板
的合并请求。成功合并后(成功定义为已批准,合并和关闭的请求)Wiki Repo中的一个新分支将使用相同的名称template_x
,并且仅包含template.md < /代码>文件。该分支将在Wiki中创建一个新页面,以显示该文件的内容
- 每当开发人员想要修改现有模板时,他们需要分配主仓库,请修改
template_x
分支并创建标记为更改模板
的合并请求。成功合并Wiki Repo中的各个分支后,将修改该页面,该页面将显示template.md
的更新内容。 - 有限的上游推送对于Wiki,这意味着没有人能够推到存储库,唯一的更新将直接来自代码存储库的更改。因此,Wiki存储库可以作为代码存储库的部分镜像存储库有资格(在某种程度上),并受到保护。这将确保两个存储库之间没有差异,如果人们可以在两者中编辑内容,否则可能会发生这种情况。如果有人想更改Wiki页面,则需要分叉,修改
template.md
并将合并请求提交给代码存储库。
如果我们之前提到的git结构将提出
(code repo) (wiki repo)
. .
| |
+ -- master + -- master
| |
+ -- template_generic + -- template_1
| |
+ -- template_1 + -- template_2
| .
+ -- template_2 .
. .
. + -- template_N
.
+ -- template_N
问题,如果是的,如果是的话,如果是的话,如何实现它(再次 - 我们拥有Gitlab的自由层)?我是Gitlab菜鸟。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Gitlab Wiki仅在主分支中显示内容,但是您可以控制您的DOC,by Git subtree 正如我在此链接中回答的那样
gitlab wiki only show content in main branch,but you can control your doc by git subtree as i answered in this link