change bugs
This commit is contained in:
parent
65b03f7c71
commit
e0d9bfab6d
|
@ -14,22 +14,20 @@ class SyncProjectsJob < ApplicationJob
|
||||||
"sync_params": sync_params
|
"sync_params": sync_params
|
||||||
}
|
}
|
||||||
uri = URI.parse(url)
|
uri = URI.parse(url)
|
||||||
if api_host
|
http = Net::HTTP.new(uri.hostname, uri.port)
|
||||||
http = Net::HTTP.new(uri.hostname, uri.port)
|
http.use_ssl = true
|
||||||
http.use_ssl = true
|
response = http.send_request('GET', uri.path, sync_params, {'Content-Type' => 'application/json'})
|
||||||
response = http.send_request('GET', uri.path, sync_params, {'Content-Type' => 'application/json'})
|
if response.status == 200
|
||||||
if response.status == 200
|
target_jsons = response.body
|
||||||
target_jsons = response.body
|
SyncLog.sync_log("=========target_jsons: #{target_jsons}============")
|
||||||
SyncLog.sync_log("=========target_jsons: #{target_jsons}============")
|
target_jsons = eval(target_jsons)
|
||||||
target_jsons = eval(target_jsons)
|
if sync_params[:type] == "Project"
|
||||||
if sync_params[:type] == "Project"
|
update_new_project(target_jsons, sync_params[:new_project_id])
|
||||||
update_new_project(target_jsons, sync_params[:new_project_id])
|
|
||||||
else
|
|
||||||
create_target(project, eval(target_jsons), sync_params[:type].to_s)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
SyncLog.sync_log("==========sync_project_to_forge_failed #{sync_params[:type]}============")
|
create_target(project, eval(target_jsons), sync_params[:type].to_s)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
SyncLog.sync_log("==========sync_project_to_forge_failed #{sync_params[:type]}============")
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
SyncLog.sync_log("==========sync_project_to_forge_failed #{sync_params[:type]}============errors:#{e}")
|
SyncLog.sync_log("==========sync_project_to_forge_failed #{sync_params[:type]}============errors:#{e}")
|
||||||
|
|
|
@ -6,6 +6,8 @@ class SyncRepositoryJob < ApplicationJob
|
||||||
def perform(repository, repository_params, gitea_main)
|
def perform(repository, repository_params, gitea_main)
|
||||||
#创建临时文件夹 clone 并强推代码
|
#创建临时文件夹 clone 并强推代码
|
||||||
SyncLog.sync_log("=================begin to sync request trustie repository=====================")
|
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]}===================")
|
||||||
path = "#{Rails.root}/public/cache_repository"
|
path = "#{Rails.root}/public/cache_repository"
|
||||||
unless File.directory?(path)
|
unless File.directory?(path)
|
||||||
FileUtils.mkdir_p(path)
|
FileUtils.mkdir_p(path)
|
||||||
|
|
Loading…
Reference in New Issue