Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
0eca206c
Commit
0eca206c
authored
Apr 26, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '28202_decrease_abc_threshold_step1' into 'master'
Decrease ABC threshold to 57.08 See merge request !10724
parents
04fcf3fa
6a541c79
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
17 deletions
+24
-17
.rubocop.yml
.rubocop.yml
+1
-1
changelogs/unreleased/28202_decrease_abc_threshold_step1.yml
changelogs/unreleased/28202_decrease_abc_threshold_step1.yml
+4
-0
lib/backup/manager.rb
lib/backup/manager.rb
+19
-16
No files found.
.rubocop.yml
View file @
0eca206c
...
@@ -543,7 +543,7 @@ Style/Proc:
...
@@ -543,7 +543,7 @@ Style/Proc:
# branches, and conditions.
# branches, and conditions.
Metrics/AbcSize
:
Metrics/AbcSize
:
Enabled
:
true
Enabled
:
true
Max
:
60
Max
:
57.08
# This cop checks if the length of a block exceeds some maximum value.
# This cop checks if the length of a block exceeds some maximum value.
Metrics/BlockLength
:
Metrics/BlockLength
:
...
...
changelogs/unreleased/28202_decrease_abc_threshold_step1.yml
0 → 100644
View file @
0eca206c
---
title
:
Decrease ABC threshold to
57.08
merge_request
:
10724
author
:
Rydkin Maxim
lib/backup/manager.rb
View file @
0eca206c
...
@@ -17,9 +17,8 @@ module Backup
...
@@ -17,9 +17,8 @@ module Backup
s
[
:skipped
]
=
ENV
[
"SKIP"
]
s
[
:skipped
]
=
ENV
[
"SKIP"
]
tar_file
=
"
#{
s
[
:backup_created_at
].
strftime
(
'%s_%Y_%m_%d'
)
}#{
FILE_NAME_SUFFIX
}
"
tar_file
=
"
#{
s
[
:backup_created_at
].
strftime
(
'%s_%Y_%m_%d'
)
}#{
FILE_NAME_SUFFIX
}
"
Dir
.
chdir
(
Gitlab
.
config
.
backup
.
path
)
do
Dir
.
chdir
(
backup_path
)
do
File
.
open
(
"
#{
Gitlab
.
config
.
backup
.
path
}
/backup_information.yml"
,
File
.
open
(
"
#{
backup_path
}
/backup_information.yml"
,
"w+"
)
do
|
file
|
"w+"
)
do
|
file
|
file
<<
s
.
to_yaml
.
gsub
(
/^---\n/
,
''
)
file
<<
s
.
to_yaml
.
gsub
(
/^---\n/
,
''
)
end
end
...
@@ -64,9 +63,9 @@ module Backup
...
@@ -64,9 +63,9 @@ module Backup
$progress
.
print
"Deleting tmp directories ... "
$progress
.
print
"Deleting tmp directories ... "
backup_contents
.
each
do
|
dir
|
backup_contents
.
each
do
|
dir
|
next
unless
File
.
exist?
(
File
.
join
(
Gitlab
.
config
.
backup
.
path
,
dir
))
next
unless
File
.
exist?
(
File
.
join
(
backup_
path
,
dir
))
if
FileUtils
.
rm_rf
(
File
.
join
(
Gitlab
.
config
.
backup
.
path
,
dir
))
if
FileUtils
.
rm_rf
(
File
.
join
(
backup_
path
,
dir
))
$progress
.
puts
"done"
.
color
(
:green
)
$progress
.
puts
"done"
.
color
(
:green
)
else
else
puts
"deleting tmp directory '
#{
dir
}
' failed"
.
color
(
:red
)
puts
"deleting tmp directory '
#{
dir
}
' failed"
.
color
(
:red
)
...
@@ -83,8 +82,8 @@ module Backup
...
@@ -83,8 +82,8 @@ module Backup
if
keep_time
>
0
if
keep_time
>
0
removed
=
0
removed
=
0
Dir
.
chdir
(
Gitlab
.
config
.
backup
.
path
)
do
Dir
.
chdir
(
backup_
path
)
do
Dir
.
glob
(
"*
#{
FILE_NAME_SUFFIX
}
"
)
.
each
do
|
file
|
backup_file_list
.
each
do
|
file
|
next
unless
file
=~
/(\d+)(?:_\d{4}_\d{2}_\d{2})?_gitlab_backup\.tar/
next
unless
file
=~
/(\d+)(?:_\d{4}_\d{2}_\d{2})?_gitlab_backup\.tar/
timestamp
=
$1
.
to_i
timestamp
=
$1
.
to_i
...
@@ -107,18 +106,14 @@ module Backup
...
@@ -107,18 +106,14 @@ module Backup
end
end
def
unpack
def
unpack
Dir
.
chdir
(
Gitlab
.
config
.
backup
.
path
)
Dir
.
chdir
(
backup_
path
)
# check for existing backups in the backup dir
# check for existing backups in the backup dir
file_list
=
Dir
.
glob
(
"*
#{
FILE_NAME_SUFFIX
}
"
)
if
backup_file_list
.
empty?
$progress
.
puts
"No backups found in
#{
backup_path
}
"
if
file_list
.
count
==
0
$progress
.
puts
"No backups found in
#{
Gitlab
.
config
.
backup
.
path
}
"
$progress
.
puts
"Please make sure that file name ends with
#{
FILE_NAME_SUFFIX
}
"
$progress
.
puts
"Please make sure that file name ends with
#{
FILE_NAME_SUFFIX
}
"
exit
1
exit
1
end
elsif
backup_file_list
.
many?
&&
ENV
[
"BACKUP"
].
nil?
if
file_list
.
count
>
1
&&
ENV
[
"BACKUP"
].
nil?
$progress
.
puts
'Found more than one backup, please specify which one you want to restore:'
$progress
.
puts
'Found more than one backup, please specify which one you want to restore:'
$progress
.
puts
'rake gitlab:backup:restore BACKUP=timestamp_of_backup'
$progress
.
puts
'rake gitlab:backup:restore BACKUP=timestamp_of_backup'
exit
1
exit
1
...
@@ -127,7 +122,7 @@ module Backup
...
@@ -127,7 +122,7 @@ module Backup
tar_file
=
if
ENV
[
'BACKUP'
].
present?
tar_file
=
if
ENV
[
'BACKUP'
].
present?
"
#{
ENV
[
'BACKUP'
]
}#{
FILE_NAME_SUFFIX
}
"
"
#{
ENV
[
'BACKUP'
]
}#{
FILE_NAME_SUFFIX
}
"
else
else
file_list
.
first
backup_
file_list
.
first
end
end
unless
File
.
exist?
(
tar_file
)
unless
File
.
exist?
(
tar_file
)
...
@@ -169,6 +164,14 @@ module Backup
...
@@ -169,6 +164,14 @@ module Backup
private
private
def
backup_path
Gitlab
.
config
.
backup
.
path
end
def
backup_file_list
@backup_file_list
||=
Dir
.
glob
(
"*
#{
FILE_NAME_SUFFIX
}
"
)
end
def
connect_to_remote_directory
(
connection_settings
)
def
connect_to_remote_directory
(
connection_settings
)
connection
=
::
Fog
::
Storage
.
new
(
connection_settings
)
connection
=
::
Fog
::
Storage
.
new
(
connection_settings
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment