BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
git.rake
lib/tasks/gitlab/git.rake
+11
-8
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
...
@@ -3,7 +3,7 @@ namespace :gitlab do
desc
"GitLab | Git | Repack"
desc
"GitLab | Git | Repack"
task
repack: :environment
do
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?
if
failures
.
empty?
puts
"Done"
.
green
puts
"Done"
.
green
else
else
...
@@ -11,9 +11,9 @@ namespace :gitlab do
...
@@ -11,9 +11,9 @@ namespace :gitlab do
end
end
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
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?
if
failures
.
empty?
puts
"Done"
.
green
puts
"Done"
.
green
else
else
...
@@ -21,9 +21,9 @@ namespace :gitlab do
...
@@ -21,9 +21,9 @@ namespace :gitlab do
end
end
end
end
desc
"GitLab | Git |
Git prune all repo'
s"
desc
"GitLab | Git |
Prune all repo
s"
task
prune: :environment
do
task
prune: :environment
do
failures
=
perform_git_cmd
(
'git prune'
,
'Git Prune'
)
failures
=
perform_git_cmd
(
%W(git prune)
,
"Git Prune"
)
if
failures
.
empty?
if
failures
.
empty?
puts
"Done"
.
green
puts
"Done"
.
green
else
else
...
@@ -35,9 +35,12 @@ namespace :gitlab do
...
@@ -35,9 +35,12 @@ namespace :gitlab do
puts
"Starting
#{
message
}
on all repositories"
puts
"Starting
#{
message
}
on all repositories"
failures
=
[]
failures
=
[]
all_repos
.
each
do
|
r
|
all_repos
do
|
repo
|
puts
"Performing
#{
message
}
at
#{
r
}
"
if
system
(
*
cmd
,
chdir:
repo
)
failures
<<
r
unless
system
(
*
%w(#{cmd})
,
chdir:
r
)
puts
"Performed
#{
message
}
at
#{
repo
}
"
else
failures
<<
repo
end
end
end
failures
failures
...
...
lib/tasks/gitlab/task_helpers.rake
View file @
8db063b5
...
@@ -130,6 +130,10 @@ namespace :gitlab do
...
@@ -130,6 +130,10 @@ namespace :gitlab do
end
end
def
all_repos
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
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