Commit c4ba2b15 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix-backup-restore' into 'master'

Fix backup restore

## What does this MR do?

This MR fixes the backup restore task.

## Are there points in the code the reviewer needs to double check?

Whether the mode 0277 makes sense. (Group SUID + group/user read/write permissions)

## Why was this MR needed?

86359ec8 broke this, and it was not caught by any specs. Users would see:

```
Restoring repositories ...
rake aborted!
NameError: undefined local variable or method `repos_path' for #<Backup::Repository:0x00000007cea1d8>
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/repository.rb:59:in `restore'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:79:in `block (4 levels) in <top (required)>'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:54:in `block (3 levels) in <top (required)>'
Tasks: TOP => gitlab:backup:repo:restore
(See full trace by running task with --trace)
```

## What are the relevant issue numbers?

#20188

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- Tests
  - [ ] Added for this feature/bug
  - [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5459
parents 720d3be2 c6ff77d4
...@@ -12,6 +12,7 @@ v 8.11.0 (unreleased) ...@@ -12,6 +12,7 @@ v 8.11.0 (unreleased)
v 8.10.2 (unreleased) v 8.10.2 (unreleased)
- Use project ID in repository cache to prevent stale data from persisting across projects - Use project ID in repository cache to prevent stale data from persisting across projects
- Fix backup restore
v 8.10.1 (unreleased) v 8.10.1 (unreleased)
- Fix Error 500 when creating Wiki pages with hyphens or spaces - Fix Error 500 when creating Wiki pages with hyphens or spaces
......
...@@ -54,10 +54,10 @@ module Backup ...@@ -54,10 +54,10 @@ module Backup
# Move repos dir to 'repositories.old' dir # Move repos dir to 'repositories.old' dir
bk_repos_path = File.join(path, '..', 'repositories.old.' + Time.now.to_i.to_s) bk_repos_path = File.join(path, '..', 'repositories.old.' + Time.now.to_i.to_s)
FileUtils.mv(path, bk_repos_path) FileUtils.mv(path, bk_repos_path)
# This is expected from gitlab:check
FileUtils.mkdir_p(path, mode: 2770)
end end
FileUtils.mkdir_p(repos_path)
Project.find_each(batch_size: 1000) do |project| Project.find_each(batch_size: 1000) do |project|
$progress.print " * #{project.path_with_namespace} ... " $progress.print " * #{project.path_with_namespace} ... "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment