Skip to content

Fix update templates Rake task for development environment

Stan Hu requested to merge sh-fix-project-template-rake-task into master

What does this MR do and why?

#372017 (closed)

Now that Gitaly Cluster manages repository directories, the update templates Rake task failed because it attempted to modify a Git repository directly on disk, which did not exist in the @hashed directory path:

% bin/rake "gitlab:update_project_templates[dotnetcore]"
Creating temporary namespace tmp-project-import-1671210988
Creating project for .NET Core
Destroying temporary namespace tmp-project-import-1671210988
rake aborted!
Gitlab::TaskFailedError: fatal: '/Users/stanhu/gdk-ee/repositories/@hashed/76/a5/76a50887d8f1c2e9301755428990ad81479ee21c25b43215cf524541e0503269.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
/Users/stanhu/gdk-ee/gitlab/lib/gitlab/task_helpers.rb:112:in `run_command!'
/Users/stanhu/gdk-ee/gitlab/lib/tasks/gitlab/update_templates.rake:90:in `block (6 levels) in <main>'
/Users/stanhu/gdk-ee/gitlab/lib/tasks/gitlab/update_templates.rake:81:in `chdir'
/Users/stanhu/gdk-ee/gitlab/lib/tasks/gitlab/update_templates.rake:81:in `block (5 levels) in <main>'
/Users/stanhu/gdk-ee/gitlab/lib/tasks/gitlab/update_templates.rake:77:in `chdir'
/Users/stanhu/gdk-ee/gitlab/lib/tasks/gitlab/update_templates.rake:77:in `block (4 levels) in <main>'
/Users/stanhu/gdk-ee/gitlab/lib/tasks/gitlab/update_templates.rake:76:in `block (3 levels) in <main>'
/Users/stanhu/gdk-ee/gitlab/lib/tasks/gitlab/update_templates.rake:43:in `each'
/Users/stanhu/gdk-ee/gitlab/lib/tasks/gitlab/update_templates.rake:43:in `block (2 levels) in <main>'
Tasks: TOP => gitlab:update_project_templates
(See full trace by running task with --trace)

To fix this, we now push directly to the SSH remote. This requires the admin user to have an SSH key and the gitlab-sshd running in the GDK.

How to set up and validate locally

Run bin/rake "gitlab:update_project_templates[dotnetcore]".

MR acceptance checklist

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

Edited by James Fargher

Merge request reports