mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
Merge branch 'dev_trustie' into dev_chain
This commit is contained in:
@@ -17,6 +17,8 @@ class SyncProjectsJob < ApplicationJob
|
||||
http = Net::HTTP.new(uri.hostname, uri.port)
|
||||
http.use_ssl = true
|
||||
response = http.send_request('GET', uri.path, sync_params, {'Content-Type' => 'application/json'})
|
||||
SyncLog.sync_log("==========response_status:#{response.status}============")
|
||||
SyncLog.sync_log("==========response_body:#{response.body}============")
|
||||
if response.status == 200
|
||||
target_jsons = response.body
|
||||
SyncLog.sync_log("=========target_jsons: #{target_jsons}============")
|
||||
@@ -48,7 +50,7 @@ class SyncProjectsJob < ApplicationJob
|
||||
|
||||
|
||||
def create_target(project, target_jsons, target_type)
|
||||
Rails.logger.info("***111222. begin_to_create_target---------------")
|
||||
Rails.logger.info("***【#{target_type}】. begin_to_create_target---------------")
|
||||
target_jsons.each do |re|
|
||||
if re[:target_params].present?
|
||||
Rails.logger.info("***user_login:#{re[:user_login]}----target_type:#{target_type}")
|
||||
|
||||
@@ -3,23 +3,23 @@ class SyncRepositoryJob < ApplicationJob
|
||||
|
||||
#同步 trustie的仓库
|
||||
|
||||
def perform(repository, repository_params, gitea_main)
|
||||
def perform(user_login, identifier, repository_params, gitea_main)
|
||||
#创建临时文件夹 clone 并强推代码
|
||||
SyncLog.sync_log("=================begin to sync request trustie repository=====================")
|
||||
SyncLog.sync_log("=================begin to sync repository_params:==#{repository_params}===================")
|
||||
SyncLog.sync_log("=================repository_url:==#{repository_params[:url]}===================")
|
||||
SyncLog.sync_log("=================repository_url:==#{repository_params[:git_url]}===================")
|
||||
path = "#{Rails.root}/public/cache_repository"
|
||||
unless File.directory?(path)
|
||||
FileUtils.mkdir_p(path)
|
||||
end
|
||||
image_url = repository_params[:url]
|
||||
image_url = repository_params[:git_url]
|
||||
g_default_branch = repository_params[:default_branch]
|
||||
image_repo_name = image_url.to_s.split('/')&.last&.chomp('.git')
|
||||
check_clone = system("cd #{path} and git clone #{image_url}")
|
||||
|
||||
|
||||
if check_clone
|
||||
new_gitlab_url = "http://root:_Trustie_10010@#{gitea_main}/#{repository.user.login}/#{repository.identifier}.git"
|
||||
new_gitlab_url = "http://root:_Trustie_10010@#{gitea_main}/#{user_login}/#{identifier}.git"
|
||||
|
||||
shell_remote_1 = system("cd #{path}/#{image_repo_name} && git remote set-url origin #{new_gitlab_url}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user