Skip to content

Make the host of project template flexible

What does this MR do and why?

In the JH addition, we already override the preview of every project template, like:

Project Template Current Preview JH Preview
rails https://gitlab.com/gitlab-org/project-templates/rails https://jihulab.com/gitlab-cn/project-templates/rails
spring https://gitlab.com/gitlab-org/project-templates/spring https://jihulab.com/gitlab-cn/project-templates/spring
express https://gitlab.com/gitlab-org/project-templates/express https://jihulab.com/gitlab-cn/project-templates/express

In the file lib/tasks/gitlab/update_templates.rake and the file spec/tasks/gitlab/update_templates_rake_spec.rb, there are some hardcode of the preview. Currently we skipped this test, but it would be better that enable this test again after they were changed flexibly:

# lib/tasks/gitlab/update_templates.rake
get_commits_response = Gitlab::HTTP.get("https://gitlab.com/api/v4/projects/#{uri_encoded_project_path}/repository/commits",
# spec/tasks/gitlab/update_templates_rake_spec.rb
stub_request(:get, %r{^https://.*/api/v4/projects/gitlab-org%2Fproject-templates%2Frails/repository/commits\?page=1&per_page=1})

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

/cc EM @daveliu

Edited by Song Huang

Merge request reports