gitlab版本库成员同步任务
This commit is contained in:
parent
42076a137d
commit
81f8559c48
|
@ -11,6 +11,22 @@ namespace :gitlab do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
task :members => :environment do
|
||||||
|
projects = Project.where("gpid is not null")
|
||||||
|
s = Trustie::Gitlab::Sync.new
|
||||||
|
g = Gitlab.client
|
||||||
|
projects.each do |project|
|
||||||
|
begin
|
||||||
|
if project.members.count != g.team_members(project.gpid).count
|
||||||
|
puts project.id
|
||||||
|
s.only_members(project)
|
||||||
|
end
|
||||||
|
rescue => e
|
||||||
|
puts e
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
desc "update user password"
|
desc "update user password"
|
||||||
task :password => :environment do
|
task :password => :environment do
|
||||||
s = Trustie::Gitlab::Sync.new
|
s = Trustie::Gitlab::Sync.new
|
||||||
|
|
|
@ -122,7 +122,7 @@ module Trustie
|
||||||
project.members.each do |m|
|
project.members.each do |m|
|
||||||
begin
|
begin
|
||||||
gid = m.user.gid
|
gid = m.user.gid
|
||||||
unless gid
|
if gid.nil?
|
||||||
gid = sync_user(m.user).id
|
gid = sync_user(m.user).id
|
||||||
end
|
end
|
||||||
self.g.add_team_member(project.gpid, gid, get_gitlab_role(m))
|
self.g.add_team_member(project.gpid, gid, get_gitlab_role(m))
|
||||||
|
|
Loading…
Reference in New Issue