|
|
@ -818,18 +818,18 @@ class ShixunsController < ApplicationController
|
|
|
|
ShixunServiceConfig.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror)
|
|
|
|
ShixunServiceConfig.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
# 自动构建版本库
|
|
|
|
自动构建版本库
|
|
|
|
# repository = Repository.new
|
|
|
|
repository = Repository.new
|
|
|
|
# repository.shixun = @shixun
|
|
|
|
repository.shixun = @shixun
|
|
|
|
# repository.type = 'Repository::Gitlab'
|
|
|
|
repository.type = 'Repository::Gitlab'
|
|
|
|
# repository.identifier = @shixun.identifier.downcase
|
|
|
|
repository.identifier = @shixun.identifier.downcase
|
|
|
|
# repository.project_id = -1
|
|
|
|
repository.project_id = -1
|
|
|
|
# repository.save!
|
|
|
|
repository.save!
|
|
|
|
# s = Trustie::Gitlab::Sync.new
|
|
|
|
s = Trustie::Gitlab::Sync.new
|
|
|
|
# gproject = s.create_shixun(@shixun, repository)
|
|
|
|
gproject = s.create_shixun(@shixun, repository)
|
|
|
|
# raise "版本库创建失败" if @shixun.gpid.blank? # 若和gitlab没同步成功,则抛出异常
|
|
|
|
raise "版本库创建失败" if @shixun.gpid.blank? # 若和gitlab没同步成功,则抛出异常
|
|
|
|
# g = Gitlab.client
|
|
|
|
g = Gitlab.client
|
|
|
|
# @shixun.update_column(:git_url, g.project(@shixun.gpid).path_with_namespace)
|
|
|
|
@shixun.update_column(:git_url, g.project(@shixun.gpid).path_with_namespace)
|
|
|
|
# g = Gitlab.client
|
|
|
|
# g = Gitlab.client
|
|
|
|
# hook_url = Setting.protocol + "://" + Setting.host_name + "/shixuns/#{@shixun.identifier}" + "/ghook"
|
|
|
|
# hook_url = Setting.protocol + "://" + Setting.host_name + "/shixuns/#{@shixun.identifier}" + "/ghook"
|
|
|
|
# g.add_project_hook(@shixun.gpid, hook_url)
|
|
|
|
# g.add_project_hook(@shixun.gpid, hook_url)
|
|
|
|