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
Boxiang Sun
gitlab-ce
Commits
8e87ecbf
Commit
8e87ecbf
authored
Jan 24, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eliminate the warnings from task helpers
parent
cb7974b8
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
45 additions
and
54 deletions
+45
-54
lib/gitlab/task_helpers.rb
lib/gitlab/task_helpers.rb
+0
-0
lib/system_check/helpers.rb
lib/system_check/helpers.rb
+0
-2
lib/tasks/gitlab/backup.rake
lib/tasks/gitlab/backup.rake
+18
-18
lib/tasks/gitlab/check.rake
lib/tasks/gitlab/check.rake
+10
-14
lib/tasks/gitlab/cleanup.rake
lib/tasks/gitlab/cleanup.rake
+4
-4
lib/tasks/gitlab/git.rake
lib/tasks/gitlab/git.rake
+4
-4
lib/tasks/gitlab/gitaly.rake
lib/tasks/gitlab/gitaly.rake
+1
-1
lib/tasks/gitlab/helpers.rake
lib/tasks/gitlab/helpers.rake
+1
-3
lib/tasks/gitlab/info.rake
lib/tasks/gitlab/info.rake
+1
-1
lib/tasks/gitlab/setup.rake
lib/tasks/gitlab/setup.rake
+1
-1
lib/tasks/gitlab/shell.rake
lib/tasks/gitlab/shell.rake
+4
-4
lib/tasks/gitlab/workhorse.rake
lib/tasks/gitlab/workhorse.rake
+1
-1
spec/tasks/gitlab/task_helpers_spec.rb
spec/tasks/gitlab/task_helpers_spec.rb
+0
-1
No files found.
lib/
tasks/
gitlab/task_helpers.rb
→
lib/gitlab/task_helpers.rb
View file @
8e87ecbf
File moved
lib/system_check/helpers.rb
View file @
8e87ecbf
require
'tasks/gitlab/task_helpers'
module
SystemCheck
module
Helpers
include
::
Gitlab
::
TaskHelpers
...
...
lib/tasks/gitlab/backup.rake
View file @
8e87ecbf
...
...
@@ -4,7 +4,7 @@ namespace :gitlab do
namespace
:backup
do
# Create backup of GitLab system
desc
"GitLab | Create a backup of the GitLab system"
task
create: :environment
do
task
create: :
gitlab_
environment
do
warn_user_is_not_gitlab
configure_cron_mode
...
...
@@ -25,7 +25,7 @@ namespace :gitlab do
# Restore backup of GitLab system
desc
'GitLab | Restore a previously created backup'
task
restore: :environment
do
task
restore: :
gitlab_
environment
do
warn_user_is_not_gitlab
configure_cron_mode
...
...
@@ -73,7 +73,7 @@ namespace :gitlab do
end
namespace
:repo
do
task
create: :environment
do
task
create: :
gitlab_
environment
do
$progress
.
puts
"Dumping repositories ..."
.
color
(
:blue
)
if
ENV
[
"SKIP"
]
&&
ENV
[
"SKIP"
].
include?
(
"repositories"
)
...
...
@@ -84,7 +84,7 @@ namespace :gitlab do
end
end
task
restore: :environment
do
task
restore: :
gitlab_
environment
do
$progress
.
puts
"Restoring repositories ..."
.
color
(
:blue
)
Backup
::
Repository
.
new
.
restore
$progress
.
puts
"done"
.
color
(
:green
)
...
...
@@ -92,7 +92,7 @@ namespace :gitlab do
end
namespace
:db
do
task
create: :environment
do
task
create: :
gitlab_
environment
do
$progress
.
puts
"Dumping database ... "
.
color
(
:blue
)
if
ENV
[
"SKIP"
]
&&
ENV
[
"SKIP"
].
include?
(
"db"
)
...
...
@@ -103,7 +103,7 @@ namespace :gitlab do
end
end
task
restore: :environment
do
task
restore: :
gitlab_
environment
do
$progress
.
puts
"Restoring database ... "
.
color
(
:blue
)
Backup
::
Database
.
new
.
restore
$progress
.
puts
"done"
.
color
(
:green
)
...
...
@@ -111,7 +111,7 @@ namespace :gitlab do
end
namespace
:builds
do
task
create: :environment
do
task
create: :
gitlab_
environment
do
$progress
.
puts
"Dumping builds ... "
.
color
(
:blue
)
if
ENV
[
"SKIP"
]
&&
ENV
[
"SKIP"
].
include?
(
"builds"
)
...
...
@@ -122,7 +122,7 @@ namespace :gitlab do
end
end
task
restore: :environment
do
task
restore: :
gitlab_
environment
do
$progress
.
puts
"Restoring builds ... "
.
color
(
:blue
)
Backup
::
Builds
.
new
.
restore
$progress
.
puts
"done"
.
color
(
:green
)
...
...
@@ -130,7 +130,7 @@ namespace :gitlab do
end
namespace
:uploads
do
task
create: :environment
do
task
create: :
gitlab_
environment
do
$progress
.
puts
"Dumping uploads ... "
.
color
(
:blue
)
if
ENV
[
"SKIP"
]
&&
ENV
[
"SKIP"
].
include?
(
"uploads"
)
...
...
@@ -141,7 +141,7 @@ namespace :gitlab do
end
end
task
restore: :environment
do
task
restore: :
gitlab_
environment
do
$progress
.
puts
"Restoring uploads ... "
.
color
(
:blue
)
Backup
::
Uploads
.
new
.
restore
$progress
.
puts
"done"
.
color
(
:green
)
...
...
@@ -149,7 +149,7 @@ namespace :gitlab do
end
namespace
:artifacts
do
task
create: :environment
do
task
create: :
gitlab_
environment
do
$progress
.
puts
"Dumping artifacts ... "
.
color
(
:blue
)
if
ENV
[
"SKIP"
]
&&
ENV
[
"SKIP"
].
include?
(
"artifacts"
)
...
...
@@ -160,7 +160,7 @@ namespace :gitlab do
end
end
task
restore: :environment
do
task
restore: :
gitlab_
environment
do
$progress
.
puts
"Restoring artifacts ... "
.
color
(
:blue
)
Backup
::
Artifacts
.
new
.
restore
$progress
.
puts
"done"
.
color
(
:green
)
...
...
@@ -168,7 +168,7 @@ namespace :gitlab do
end
namespace
:pages
do
task
create: :environment
do
task
create: :
gitlab_
environment
do
$progress
.
puts
"Dumping pages ... "
.
color
(
:blue
)
if
ENV
[
"SKIP"
]
&&
ENV
[
"SKIP"
].
include?
(
"pages"
)
...
...
@@ -179,7 +179,7 @@ namespace :gitlab do
end
end
task
restore: :environment
do
task
restore: :
gitlab_
environment
do
$progress
.
puts
"Restoring pages ... "
.
color
(
:blue
)
Backup
::
Pages
.
new
.
restore
$progress
.
puts
"done"
.
color
(
:green
)
...
...
@@ -187,7 +187,7 @@ namespace :gitlab do
end
namespace
:lfs
do
task
create: :environment
do
task
create: :
gitlab_
environment
do
$progress
.
puts
"Dumping lfs objects ... "
.
color
(
:blue
)
if
ENV
[
"SKIP"
]
&&
ENV
[
"SKIP"
].
include?
(
"lfs"
)
...
...
@@ -198,7 +198,7 @@ namespace :gitlab do
end
end
task
restore: :environment
do
task
restore: :
gitlab_
environment
do
$progress
.
puts
"Restoring lfs objects ... "
.
color
(
:blue
)
Backup
::
Lfs
.
new
.
restore
$progress
.
puts
"done"
.
color
(
:green
)
...
...
@@ -206,7 +206,7 @@ namespace :gitlab do
end
namespace
:registry
do
task
create: :environment
do
task
create: :
gitlab_
environment
do
$progress
.
puts
"Dumping container registry images ... "
.
color
(
:blue
)
if
Gitlab
.
config
.
registry
.
enabled
...
...
@@ -221,7 +221,7 @@ namespace :gitlab do
end
end
task
restore: :environment
do
task
restore: :
gitlab_
environment
do
$progress
.
puts
"Restoring container registry images ... "
.
color
(
:blue
)
if
Gitlab
.
config
.
registry
.
enabled
...
...
lib/tasks/gitlab/check.rake
View file @
8e87ecbf
# Temporary hack, until we migrate all checks to SystemCheck format
require
'system_check'
require
'system_check/helpers'
namespace
:gitlab
do
desc
'GitLab | Check the configuration of GitLab and its environment'
task
check:
%w{gitlab:gitlab_shell:check
...
...
@@ -12,7 +8,7 @@ namespace :gitlab do
namespace
:app
do
desc
'GitLab | Check the configuration of the GitLab Rails app'
task
check: :
environment
do
task
check: :
gitlab_environment
do
warn_user_is_not_gitlab
checks
=
[
...
...
@@ -43,7 +39,7 @@ namespace :gitlab do
namespace
:gitlab_shell
do
desc
"GitLab | Check the configuration of GitLab Shell"
task
check: :
environment
do
task
check: :
gitlab_environment
do
warn_user_is_not_gitlab
start_checking
"GitLab Shell"
...
...
@@ -251,7 +247,7 @@ namespace :gitlab do
namespace
:sidekiq
do
desc
"GitLab | Check the configuration of Sidekiq"
task
check: :
environment
do
task
check: :
gitlab_environment
do
warn_user_is_not_gitlab
start_checking
"Sidekiq"
...
...
@@ -310,7 +306,7 @@ namespace :gitlab do
namespace
:incoming_email
do
desc
"GitLab | Check the configuration of Reply by email"
task
check: :
environment
do
task
check: :
gitlab_environment
do
warn_user_is_not_gitlab
if
Gitlab
.
config
.
incoming_email
.
enabled
...
...
@@ -333,7 +329,7 @@ namespace :gitlab do
end
namespace
:ldap
do
task
:check
,
[
:limit
]
=>
:environment
do
|
_
,
args
|
task
:check
,
[
:limit
]
=>
:
gitlab_
environment
do
|
_
,
args
|
# Only show up to 100 results because LDAP directories can be very big.
# This setting only affects the `rake gitlab:check` script.
args
.
with_defaults
(
limit:
100
)
...
...
@@ -389,7 +385,7 @@ namespace :gitlab do
namespace
:repo
do
desc
"GitLab | Check the integrity of the repositories managed by GitLab"
task
check: :environment
do
task
check: :
gitlab_
environment
do
puts
"This task is deprecated. Please use gitlab:git:fsck instead"
.
color
(
:red
)
Rake
::
Task
[
"gitlab:git:fsck"
].
execute
end
...
...
@@ -397,7 +393,7 @@ namespace :gitlab do
namespace
:orphans
do
desc
'Gitlab | Check for orphaned namespaces and repositories'
task
check: :environment
do
task
check: :
gitlab_
environment
do
warn_user_is_not_gitlab
checks
=
[
SystemCheck
::
Orphans
::
NamespaceCheck
,
...
...
@@ -408,7 +404,7 @@ namespace :gitlab do
end
desc
'GitLab | Check for orphaned namespaces in the repositories path'
task
check_namespaces: :environment
do
task
check_namespaces: :
gitlab_
environment
do
warn_user_is_not_gitlab
checks
=
[
SystemCheck
::
Orphans
::
NamespaceCheck
]
...
...
@@ -416,7 +412,7 @@ namespace :gitlab do
end
desc
'GitLab | Check for orphaned repositories in the repositories path'
task
check_repositories: :environment
do
task
check_repositories: :
gitlab_
environment
do
warn_user_is_not_gitlab
checks
=
[
SystemCheck
::
Orphans
::
RepositoryCheck
]
...
...
@@ -426,7 +422,7 @@ namespace :gitlab do
namespace
:user
do
desc
"GitLab | Check the integrity of a specific user's repositories"
task
:check_repos
,
[
:username
]
=>
:environment
do
|
t
,
args
|
task
:check_repos
,
[
:username
]
=>
:
gitlab_
environment
do
|
t
,
args
|
username
=
args
[
:username
]
||
prompt
(
"Check repository integrity for username? "
.
color
(
:blue
))
user
=
User
.
find_by
(
username:
username
)
if
user
...
...
lib/tasks/gitlab/cleanup.rake
View file @
8e87ecbf
...
...
@@ -5,7 +5,7 @@ namespace :gitlab do
HASHED_REPOSITORY_NAME
=
'@hashed'
.
freeze
desc
"GitLab | Cleanup | Clean namespaces"
task
dirs: :
environment
do
task
dirs: :
gitlab_environment
do
warn_user_is_not_gitlab
remove_flag
=
ENV
[
'REMOVE'
]
...
...
@@ -49,7 +49,7 @@ namespace :gitlab do
end
desc
"GitLab | Cleanup | Clean repositories"
task
repos: :
environment
do
task
repos: :
gitlab_environment
do
warn_user_is_not_gitlab
move_suffix
=
"+orphaned+
#{
Time
.
now
.
to_i
}
"
...
...
@@ -78,7 +78,7 @@ namespace :gitlab do
end
desc
"GitLab | Cleanup | Block users that have been removed in LDAP"
task
block_removed_ldap_users: :
environment
do
task
block_removed_ldap_users: :
gitlab_environment
do
warn_user_is_not_gitlab
block_flag
=
ENV
[
'BLOCK'
]
...
...
@@ -109,7 +109,7 @@ namespace :gitlab do
# released. So likely this should only be run once on gitlab.com
# Faulty refs are moved so they are kept around, else some features break.
desc
'GitLab | Cleanup | Remove faulty deployment refs'
task
move_faulty_deployment_refs: :environment
do
task
move_faulty_deployment_refs: :
gitlab_
environment
do
projects
=
Project
.
where
(
id:
Deployment
.
select
(
:project_id
).
distinct
)
projects
.
find_each
do
|
project
|
...
...
lib/tasks/gitlab/git.rake
View file @
8e87ecbf
namespace
:gitlab
do
namespace
:git
do
desc
"GitLab | Git | Repack"
task
repack: :environment
do
task
repack: :
gitlab_
environment
do
failures
=
perform_git_cmd
(
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
repack -a --quiet)
,
"Repacking repo"
)
if
failures
.
empty?
puts
"Done"
.
color
(
:green
)
...
...
@@ -11,7 +11,7 @@ namespace :gitlab do
end
desc
"GitLab | Git | Run garbage collection on all repos"
task
gc: :environment
do
task
gc: :
gitlab_
environment
do
failures
=
perform_git_cmd
(
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
gc --auto --quiet)
,
"Garbage Collecting"
)
if
failures
.
empty?
puts
"Done"
.
color
(
:green
)
...
...
@@ -21,7 +21,7 @@ namespace :gitlab do
end
desc
"GitLab | Git | Prune all repos"
task
prune: :environment
do
task
prune: :
gitlab_
environment
do
failures
=
perform_git_cmd
(
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
prune)
,
"Git Prune"
)
if
failures
.
empty?
puts
"Done"
.
color
(
:green
)
...
...
@@ -31,7 +31,7 @@ namespace :gitlab do
end
desc
'GitLab | Git | Check all repos integrity'
task
fsck: :environment
do
task
fsck: :
gitlab_
environment
do
failures
=
perform_git_cmd
(
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
fsck --name-objects --no-progress)
,
"Checking integrity"
)
do
|
repo
|
check_config_lock
(
repo
)
check_ref_locks
(
repo
)
...
...
lib/tasks/gitlab/gitaly.rake
View file @
8e87ecbf
namespace
:gitlab
do
namespace
:gitaly
do
desc
"GitLab | Install or upgrade gitaly"
task
:install
,
[
:dir
,
:repo
]
=>
:environment
do
|
t
,
args
|
task
:install
,
[
:dir
,
:repo
]
=>
:
gitlab_
environment
do
|
t
,
args
|
require
'toml'
warn_user_is_not_gitlab
...
...
lib/tasks/gitlab/helpers.rake
View file @
8e87ecbf
require
'tasks/gitlab/task_helpers'
# Prevent StateMachine warnings from outputting during a cron task
StateMachines
::
Machine
.
ignore_method_conflicts
=
true
if
ENV
[
'CRON'
]
namespace
:gitlab
do
task
gitlab_environment: :environment
do
extend
SystemCheck
::
Helpers
end
lib/tasks/gitlab/info.rake
View file @
8e87ecbf
namespace
:gitlab
do
namespace
:env
do
desc
"GitLab | Show information about GitLab and its environment"
task
info: :
environment
do
task
info: :
gitlab_environment
do
# check if there is an RVM environment
rvm_version
=
run_and_match
(
%w(rvm --version)
,
/[\d\.]+/
).
try
(
:to_s
)
# check Ruby version
...
...
lib/tasks/gitlab/setup.rake
View file @
8e87ecbf
namespace
:gitlab
do
desc
"GitLab | Setup production application"
task
setup: :environment
do
task
setup: :
gitlab_
environment
do
setup_db
end
...
...
lib/tasks/gitlab/shell.rake
View file @
8e87ecbf
namespace
:gitlab
do
namespace
:shell
do
desc
"GitLab | Install or upgrade gitlab-shell"
task
:install
,
[
:repo
]
=>
:environment
do
|
t
,
args
|
task
:install
,
[
:repo
]
=>
:
gitlab_
environment
do
|
t
,
args
|
warn_user_is_not_gitlab
default_version
=
Gitlab
::
Shell
.
version_required
...
...
@@ -58,12 +58,12 @@ namespace :gitlab do
end
desc
"GitLab | Setup gitlab-shell"
task
setup: :environment
do
task
setup: :
gitlab_
environment
do
setup
end
desc
"GitLab | Build missing projects"
task
build_missing_projects: :environment
do
task
build_missing_projects: :
gitlab_
environment
do
Project
.
find_each
(
batch_size:
1000
)
do
|
project
|
path_to_repo
=
project
.
repository
.
path_to_repo
if
File
.
exist?
(
path_to_repo
)
...
...
@@ -80,7 +80,7 @@ namespace :gitlab do
end
desc
'Create or repair repository hooks symlink'
task
create_hooks: :environment
do
task
create_hooks: :
gitlab_
environment
do
warn_user_is_not_gitlab
puts
'Creating/Repairing hooks symlinks for all repositories'
...
...
lib/tasks/gitlab/workhorse.rake
View file @
8e87ecbf
namespace
:gitlab
do
namespace
:workhorse
do
desc
"GitLab | Install or upgrade gitlab-workhorse"
task
:install
,
[
:dir
,
:repo
]
=>
:environment
do
|
t
,
args
|
task
:install
,
[
:dir
,
:repo
]
=>
:
gitlab_
environment
do
|
t
,
args
|
warn_user_is_not_gitlab
unless
args
.
dir
.
present?
...
...
spec/tasks/gitlab/task_helpers_spec.rb
View file @
8e87ecbf
require
'spec_helper'
require
'tasks/gitlab/task_helpers'
class
TestHelpersTest
include
Gitlab
::
TaskHelpers
...
...
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