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
8db063b5
Commit
8db063b5
authored
Oct 01, 2015
by
Zeger-Jan van de Weg
Committed by
Zeger-Jan van de Weg
Oct 14, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scalable way of requesting all repos
parent
54e6c004
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
lib/tasks/gitlab/git.rake
lib/tasks/gitlab/git.rake
+11
-8
lib/tasks/gitlab/task_helpers.rake
lib/tasks/gitlab/task_helpers.rake
+5
-1
No files found.
lib/tasks/gitlab/git.rake
View file @
8db063b5
...
...
@@ -3,7 +3,7 @@ namespace :gitlab do
desc
"GitLab | Git | Repack"
task
repack: :environment
do
failures
=
perform_git_cmd
(
'git repack -a --quiet'
,
'Git repack'
)
failures
=
perform_git_cmd
(
%W(git repack -a --quiet)
,
"Repacking repo"
)
if
failures
.
empty?
puts
"Done"
.
green
else
...
...
@@ -11,9 +11,9 @@ namespace :gitlab do
end
end
desc
"GitLab | Git | Run g
its garbage collection on all repo'
s"
desc
"GitLab | Git | Run g
arbage collection on all repo
s"
task
gc: :environment
do
failures
=
perform_git_cmd
(
'git gc --auto --quiet'
,
"Garbage Collection
"
)
failures
=
perform_git_cmd
(
%W(git gc --auto --quiet)
,
"Garbage Collecting
"
)
if
failures
.
empty?
puts
"Done"
.
green
else
...
...
@@ -21,9 +21,9 @@ namespace :gitlab do
end
end
desc
"GitLab | Git |
Git prune all repo'
s"
desc
"GitLab | Git |
Prune all repo
s"
task
prune: :environment
do
failures
=
perform_git_cmd
(
'git prune'
,
'Git Prune'
)
failures
=
perform_git_cmd
(
%W(git prune)
,
"Git Prune"
)
if
failures
.
empty?
puts
"Done"
.
green
else
...
...
@@ -35,9 +35,12 @@ namespace :gitlab do
puts
"Starting
#{
message
}
on all repositories"
failures
=
[]
all_repos
.
each
do
|
r
|
puts
"Performing
#{
message
}
at
#{
r
}
"
failures
<<
r
unless
system
(
*
%w(#{cmd})
,
chdir:
r
)
all_repos
do
|
repo
|
if
system
(
*
cmd
,
chdir:
repo
)
puts
"Performed
#{
message
}
at
#{
repo
}
"
else
failures
<<
repo
end
end
failures
...
...
lib/tasks/gitlab/task_helpers.rake
View file @
8db063b5
...
...
@@ -130,6 +130,10 @@ namespace :gitlab do
end
def
all_repos
Dir
.
glob
(
File
.
join
(
Gitlab
.
config
.
gitlab_shell
.
repos_path
,
'**/*\.git'
))
IO
.
popen
(
%W(find
#{
Gitlab
.
config
.
gitlab_shell
.
repos_path
}
-mindepth 2 -maxdepth 2 -type d -name *.git)
)
do
|
find
|
find
.
each_line
do
|
path
|
yield
path
.
chomp
end
end
end
end
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