本页面介绍如何贡献内置项目模板。
贡献内置项目模板,您必须完成以下任务:
project-templates
或 pages
群组。如果项目模板拥有 SVG 图标,您必须在使用项目模板详细信息创建合并请求之前将其添加到极狐SVG 仓库中。
在极狐GitLab 实施项目模板之前,您必须创建合并请求。
导出项目并将文件保存为 <name>.tar.gz
,其中 <name>
是项目名称的简写。
gitlab-cn/gitlab
中,创建并检出新分支。<name>.tar.gz
添加到 jh/vendor/project_templates
目录中。在 jh/lib/jh/gitlab/project_template.rb
中,在 localized_jh_templates_table
方法中添加模板的详细信息。
在以下示例中,项目名称简写为 dongtai_iast
:
::Gitlab::ProjectTemplate.new('dongtai_iast', 'DongTai IAST', _('A demo project showing how DongTai IAST integrates into DevOps for detecting vulnerabilities'), 'https://jihulab.com/gitlab-cn/project-templates/dongtai-iast', 'illustrations/jh/logos/dongtai.svg')
如果项目没有 SVG 图标,则不要包括 , 'illustrations/jh/logos/dongtai.svg'
。
jh/spec/support/helpers/project_template_test_helper.rb
中,在 all_templates
的方法中附加模板名称的简写。在 jh/app/assets/javascripts/projects/default_project_templates.js
中,添加模板的详细信息。例如:
dongtai_iast: {
text: s__('ProjectTemplates|DongTai IAST'),
icon: '.template-option .icon-dongtai_iast',
},
如果项目没有 SVG 图标,使用 .icon-gitlab_logo
代替。
要更新现存内置项目模板:
project-templates
和 pages
群组相关的项目中创建合并请求。