GitLab-通过在代码存储库中跟踪特定文件来自动管理存储库Wiki页面?

发布于 2025-01-22 13:00:21 字数 2645 浏览 4 评论 0原文

我们的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 the README file, where all processes related to the repo are described
  • template_generic contains two files namely template.md and LICENSE with the first providing a generic documentation description (with place holders such as title, description, usage, changelog, examples etc.) and latter - licensing information
  • template_X contains the building blocks (code snippets, environment setup etc.) for a project that fits its description. Usually derived from template_generic but can also be derived from multiple other template_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 from template_generic) and create a merge request labeled as new 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 name template_X and will contain just the template.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 as change template. Upon successful merging the respective branch in the Wiki repo will be modified and the page will display the updated contents of template.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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神经大条 2025-01-29 13:00:21

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文