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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
eee07f1c
Commit
eee07f1c
authored
Mar 24, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand relative paths in storages
parent
8f50ef5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
12 deletions
+21
-12
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+19
-10
spec/tasks/gitlab/backup_rake_spec.rb
spec/tasks/gitlab/backup_rake_spec.rb
+2
-2
No files found.
config/initializers/1_settings.rb
View file @
eee07f1c
...
@@ -79,6 +79,10 @@ class Settings < Settingslogic
...
@@ -79,6 +79,10 @@ class Settings < Settingslogic
value
value
end
end
def
absolute
(
path
)
File
.
expand_path
(
path
,
Rails
.
root
)
end
private
private
def
base_url
(
config
)
def
base_url
(
config
)
...
@@ -178,7 +182,7 @@ if github_settings
...
@@ -178,7 +182,7 @@ if github_settings
end
end
Settings
[
'shared'
]
||=
Settingslogic
.
new
({})
Settings
[
'shared'
]
||=
Settingslogic
.
new
({})
Settings
.
shared
[
'path'
]
=
File
.
expand_path
(
Settings
.
shared
[
'path'
]
||
"shared"
,
Rails
.
root
)
Settings
.
shared
[
'path'
]
=
Settings
.
absolute
(
Settings
.
shared
[
'path'
]
||
"shared"
)
Settings
[
'issues_tracker'
]
||=
{}
Settings
[
'issues_tracker'
]
||=
{}
...
@@ -237,7 +241,7 @@ Settings['gitlab_ci'] ||= Settingslogic.new({})
...
@@ -237,7 +241,7 @@ Settings['gitlab_ci'] ||= Settingslogic.new({})
Settings
.
gitlab_ci
[
'shared_runners_enabled'
]
=
true
if
Settings
.
gitlab_ci
[
'shared_runners_enabled'
].
nil?
Settings
.
gitlab_ci
[
'shared_runners_enabled'
]
=
true
if
Settings
.
gitlab_ci
[
'shared_runners_enabled'
].
nil?
Settings
.
gitlab_ci
[
'all_broken_builds'
]
=
true
if
Settings
.
gitlab_ci
[
'all_broken_builds'
].
nil?
Settings
.
gitlab_ci
[
'all_broken_builds'
]
=
true
if
Settings
.
gitlab_ci
[
'all_broken_builds'
].
nil?
Settings
.
gitlab_ci
[
'add_pusher'
]
=
false
if
Settings
.
gitlab_ci
[
'add_pusher'
].
nil?
Settings
.
gitlab_ci
[
'add_pusher'
]
=
false
if
Settings
.
gitlab_ci
[
'add_pusher'
].
nil?
Settings
.
gitlab_ci
[
'builds_path'
]
=
File
.
expand_path
(
Settings
.
gitlab_ci
[
'builds_path'
]
||
"builds/"
,
Rails
.
root
)
Settings
.
gitlab_ci
[
'builds_path'
]
=
Settings
.
absolute
(
Settings
.
gitlab_ci
[
'builds_path'
]
||
"builds/"
)
Settings
.
gitlab_ci
[
'url'
]
||=
Settings
.
send
(
:build_gitlab_ci_url
)
Settings
.
gitlab_ci
[
'url'
]
||=
Settings
.
send
(
:build_gitlab_ci_url
)
#
#
...
@@ -251,7 +255,7 @@ Settings.incoming_email['enabled'] = false if Settings.incoming_email['enabled']
...
@@ -251,7 +255,7 @@ Settings.incoming_email['enabled'] = false if Settings.incoming_email['enabled']
#
#
Settings
[
'artifacts'
]
||=
Settingslogic
.
new
({})
Settings
[
'artifacts'
]
||=
Settingslogic
.
new
({})
Settings
.
artifacts
[
'enabled'
]
=
true
if
Settings
.
artifacts
[
'enabled'
].
nil?
Settings
.
artifacts
[
'enabled'
]
=
true
if
Settings
.
artifacts
[
'enabled'
].
nil?
Settings
.
artifacts
[
'path'
]
=
File
.
expand_path
(
Settings
.
artifacts
[
'path'
]
||
File
.
join
(
Settings
.
shared
[
'path'
],
"artifacts"
),
Rails
.
root
)
Settings
.
artifacts
[
'path'
]
=
Settings
.
absolute
(
Settings
.
artifacts
[
'path'
]
||
File
.
join
(
Settings
.
shared
[
'path'
],
"artifacts"
)
)
Settings
.
artifacts
[
'max_size'
]
||=
100
# in megabytes
Settings
.
artifacts
[
'max_size'
]
||=
100
# in megabytes
#
#
...
@@ -265,14 +269,14 @@ Settings.registry['api_url'] ||= "http://localhost:5000/"
...
@@ -265,14 +269,14 @@ Settings.registry['api_url'] ||= "http://localhost:5000/"
Settings
.
registry
[
'key'
]
||=
nil
Settings
.
registry
[
'key'
]
||=
nil
Settings
.
registry
[
'issuer'
]
||=
nil
Settings
.
registry
[
'issuer'
]
||=
nil
Settings
.
registry
[
'host_port'
]
||=
[
Settings
.
registry
[
'host'
],
Settings
.
registry
[
'port'
]].
compact
.
join
(
':'
)
Settings
.
registry
[
'host_port'
]
||=
[
Settings
.
registry
[
'host'
],
Settings
.
registry
[
'port'
]].
compact
.
join
(
':'
)
Settings
.
registry
[
'path'
]
=
File
.
expand_path
(
Settings
.
registry
[
'path'
]
||
File
.
join
(
Settings
.
shared
[
'path'
],
'registry'
),
Rails
.
root
)
Settings
.
registry
[
'path'
]
=
Settings
.
absolute
(
Settings
.
registry
[
'path'
]
||
File
.
join
(
Settings
.
shared
[
'path'
],
'registry'
)
)
#
#
# Pages
# Pages
#
#
Settings
[
'pages'
]
||=
Settingslogic
.
new
({})
Settings
[
'pages'
]
||=
Settingslogic
.
new
({})
Settings
.
pages
[
'enabled'
]
=
false
if
Settings
.
pages
[
'enabled'
].
nil?
Settings
.
pages
[
'enabled'
]
=
false
if
Settings
.
pages
[
'enabled'
].
nil?
Settings
.
pages
[
'path'
]
=
File
.
expand_path
(
Settings
.
pages
[
'path'
]
||
File
.
join
(
Settings
.
shared
[
'path'
],
"pages"
),
Rails
.
root
)
Settings
.
pages
[
'path'
]
=
Settings
.
absolute
(
Settings
.
pages
[
'path'
]
||
File
.
join
(
Settings
.
shared
[
'path'
],
"pages"
)
)
Settings
.
pages
[
'https'
]
=
false
if
Settings
.
pages
[
'https'
].
nil?
Settings
.
pages
[
'https'
]
=
false
if
Settings
.
pages
[
'https'
].
nil?
Settings
.
pages
[
'host'
]
||=
"example.com"
Settings
.
pages
[
'host'
]
||=
"example.com"
Settings
.
pages
[
'port'
]
||=
Settings
.
pages
.
https
?
443
:
80
Settings
.
pages
[
'port'
]
||=
Settings
.
pages
.
https
?
443
:
80
...
@@ -286,7 +290,7 @@ Settings.pages['external_https'] ||= false unless Settings.pages['external_http
...
@@ -286,7 +290,7 @@ Settings.pages['external_https'] ||= false unless Settings.pages['external_http
#
#
Settings
[
'lfs'
]
||=
Settingslogic
.
new
({})
Settings
[
'lfs'
]
||=
Settingslogic
.
new
({})
Settings
.
lfs
[
'enabled'
]
=
true
if
Settings
.
lfs
[
'enabled'
].
nil?
Settings
.
lfs
[
'enabled'
]
=
true
if
Settings
.
lfs
[
'enabled'
].
nil?
Settings
.
lfs
[
'storage_path'
]
=
File
.
expand_path
(
Settings
.
lfs
[
'storage_path'
]
||
File
.
join
(
Settings
.
shared
[
'path'
],
"lfs-objects"
),
Rails
.
root
)
Settings
.
lfs
[
'storage_path'
]
=
Settings
.
absolute
(
Settings
.
lfs
[
'storage_path'
]
||
File
.
join
(
Settings
.
shared
[
'path'
],
"lfs-objects"
)
)
#
#
# Mattermost
# Mattermost
...
@@ -350,8 +354,8 @@ Settings.cron_jobs['remove_unreferenced_lfs_objects_worker']['job_class'] = 'Rem
...
@@ -350,8 +354,8 @@ Settings.cron_jobs['remove_unreferenced_lfs_objects_worker']['job_class'] = 'Rem
# GitLab Shell
# GitLab Shell
#
#
Settings
[
'gitlab_shell'
]
||=
Settingslogic
.
new
({})
Settings
[
'gitlab_shell'
]
||=
Settingslogic
.
new
({})
Settings
.
gitlab_shell
[
'path'
]
||=
Settings
.
gitlab
[
'user_home'
]
+
'/gitlab-shell/'
Settings
.
gitlab_shell
[
'path'
]
=
Settings
.
absolute
(
Settings
.
gitlab_shell
[
'path'
]
||
Settings
.
gitlab
[
'user_home'
]
+
'/gitlab-shell/'
)
Settings
.
gitlab_shell
[
'hooks_path'
]
||=
Settings
.
gitlab
[
'user_home'
]
+
'/gitlab-shell/hooks/'
Settings
.
gitlab_shell
[
'hooks_path'
]
=
Settings
.
absolute
(
Settings
.
gitlab_shell
[
'hooks_path'
]
||
Settings
.
gitlab
[
'user_home'
]
+
'/gitlab-shell/hooks/'
)
Settings
.
gitlab_shell
[
'secret_file'
]
||=
Rails
.
root
.
join
(
'.gitlab_shell_secret'
)
Settings
.
gitlab_shell
[
'secret_file'
]
||=
Rails
.
root
.
join
(
'.gitlab_shell_secret'
)
Settings
.
gitlab_shell
[
'receive_pack'
]
=
true
if
Settings
.
gitlab_shell
[
'receive_pack'
].
nil?
Settings
.
gitlab_shell
[
'receive_pack'
]
=
true
if
Settings
.
gitlab_shell
[
'receive_pack'
].
nil?
Settings
.
gitlab_shell
[
'upload_pack'
]
=
true
if
Settings
.
gitlab_shell
[
'upload_pack'
].
nil?
Settings
.
gitlab_shell
[
'upload_pack'
]
=
true
if
Settings
.
gitlab_shell
[
'upload_pack'
].
nil?
...
@@ -374,6 +378,11 @@ unless Settings.repositories.storages['default']
...
@@ -374,6 +378,11 @@ unless Settings.repositories.storages['default']
Settings
.
repositories
.
storages
[
'default'
][
'path'
]
||=
Settings
.
gitlab
[
'user_home'
]
+
'/repositories/'
Settings
.
repositories
.
storages
[
'default'
][
'path'
]
||=
Settings
.
gitlab
[
'user_home'
]
+
'/repositories/'
end
end
Settings
.
repositories
.
storages
.
values
.
each
do
|
storage
|
# Expand relative paths
storage
[
'path'
]
=
Settings
.
absolute
(
storage
[
'path'
])
end
#
#
# The repository_downloads_path is used to remove outdated repository
# The repository_downloads_path is used to remove outdated repository
# archives, if someone has it configured incorrectly, and it points
# archives, if someone has it configured incorrectly, and it points
...
@@ -395,7 +404,7 @@ end
...
@@ -395,7 +404,7 @@ end
Settings
[
'backup'
]
||=
Settingslogic
.
new
({})
Settings
[
'backup'
]
||=
Settingslogic
.
new
({})
Settings
.
backup
[
'keep_time'
]
||=
0
Settings
.
backup
[
'keep_time'
]
||=
0
Settings
.
backup
[
'pg_schema'
]
=
nil
Settings
.
backup
[
'pg_schema'
]
=
nil
Settings
.
backup
[
'path'
]
=
File
.
expand_path
(
Settings
.
backup
[
'path'
]
||
"tmp/backups/"
,
Rails
.
root
)
Settings
.
backup
[
'path'
]
=
Settings
.
absolute
(
Settings
.
backup
[
'path'
]
||
"tmp/backups/"
)
Settings
.
backup
[
'archive_permissions'
]
||=
0600
Settings
.
backup
[
'archive_permissions'
]
||=
0600
Settings
.
backup
[
'upload'
]
||=
Settingslogic
.
new
({
'remote_directory'
=>
nil
,
'connection'
=>
nil
})
Settings
.
backup
[
'upload'
]
||=
Settingslogic
.
new
({
'remote_directory'
=>
nil
,
'connection'
=>
nil
})
# Convert upload connection settings to use symbol keys, to make Fog happy
# Convert upload connection settings to use symbol keys, to make Fog happy
...
@@ -418,7 +427,7 @@ Settings.git['timeout'] ||= 10
...
@@ -418,7 +427,7 @@ Settings.git['timeout'] ||= 10
# least. This setting is fed to 'rm -rf' in
# least. This setting is fed to 'rm -rf' in
# db/migrate/20151023144219_remove_satellites.rb
# db/migrate/20151023144219_remove_satellites.rb
Settings
[
'satellites'
]
||=
Settingslogic
.
new
({})
Settings
[
'satellites'
]
||=
Settingslogic
.
new
({})
Settings
.
satellites
[
'path'
]
=
File
.
expand_path
(
Settings
.
satellites
[
'path'
]
||
"tmp/repo_satellites/"
,
Rails
.
root
)
Settings
.
satellites
[
'path'
]
=
Settings
.
absolute
(
Settings
.
satellites
[
'path'
]
||
"tmp/repo_satellites/"
)
#
#
# Extra customization
# Extra customization
...
...
spec/tasks/gitlab/backup_rake_spec.rb
View file @
eee07f1c
...
@@ -227,8 +227,8 @@ describe 'gitlab:app namespace rake task' do
...
@@ -227,8 +227,8 @@ describe 'gitlab:app namespace rake task' do
FileUtils
.
mkdir
(
'tmp/tests/default_storage'
)
FileUtils
.
mkdir
(
'tmp/tests/default_storage'
)
FileUtils
.
mkdir
(
'tmp/tests/custom_storage'
)
FileUtils
.
mkdir
(
'tmp/tests/custom_storage'
)
storages
=
{
storages
=
{
'default'
=>
{
'path'
=>
'tmp/tests/default_storage'
},
'default'
=>
{
'path'
=>
Settings
.
absolute
(
'tmp/tests/default_storage'
)
},
'custom'
=>
{
'path'
=>
'tmp/tests/custom_storage'
}
'custom'
=>
{
'path'
=>
Settings
.
absolute
(
'tmp/tests/custom_storage'
)
}
}
}
allow
(
Gitlab
.
config
.
repositories
).
to
receive
(
:storages
).
and_return
(
storages
)
allow
(
Gitlab
.
config
.
repositories
).
to
receive
(
:storages
).
and_return
(
storages
)
...
...
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