From c2dee3b831cd503f35946142b21d3cc4cef3b2f4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 26 Jun 2019 17:47:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E4=B9=8B=E5=89=8D=E7=9A=84?= =?UTF-8?q?=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 44e67e54..744dd683 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -817,18 +817,18 @@ class ShixunsController < ApplicationController ShixunServiceConfig.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror) end end - # # 自动构建版本库 - # repository = Repository.new - # repository.shixun = @shixun - # repository.type = 'Repository::Gitlab' - # repository.identifier = @shixun.identifier.downcase - # repository.project_id = -1 - # repository.save! - # s = Trustie::Gitlab::Sync.new - # gproject = s.create_shixun(@shixun, repository) - # raise "版本库创建失败" if @shixun.gpid.blank? # 若和gitlab没同步成功,则抛出异常 - # g = Gitlab.client - # @shixun.update_column(:git_url, g.project(@shixun.gpid).path_with_namespace) + # 自动构建版本库 + repository = Repository.new + repository.shixun = @shixun + repository.type = 'Repository::Gitlab' + repository.identifier = @shixun.identifier.downcase + repository.project_id = -1 + repository.save! + s = Trustie::Gitlab::Sync.new + gproject = s.create_shixun(@shixun, repository) + raise "版本库创建失败" if @shixun.gpid.blank? # 若和gitlab没同步成功,则抛出异常 + g = Gitlab.client + @shixun.update_column(:git_url, g.project(@shixun.gpid).path_with_namespace) # g = Gitlab.client # hook_url = Setting.protocol + "://" + Setting.host_name + "/shixuns/#{@shixun.identifier}" + "/ghook" # g.add_project_hook(@shixun.gpid, hook_url)