Browse Source

Merge branch 'dev_trustie' into dev_chain

tags/v1.0.0
sylor_huang@126.com 6 years ago
parent
commit
944e5de8c6
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      app/jobs/sync_repository_job.rb

+ 4
- 4
app/jobs/sync_repository_job.rb View File

@@ -5,12 +5,12 @@ class SyncRepositoryJob < ApplicationJob

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 request trustie repository:#{repository_params}=====================")
path = "#{Rails.root}/public/cache_repository"
image_url = repository_params[:git_url]
gitlab_branches = repository_params[:gitlab_branches]
image_repo_name = image_url.to_s.split('/')&.last&.chomp('.git')
SyncLog.sync_project_log("========gitlab_branches:#{gitlab_branches}===================")
unless File.directory?(path)
FileUtils.mkdir_p(path)
end
@@ -20,9 +20,9 @@ class SyncRepositoryJob < ApplicationJob
end

check_clone = system("cd #{path} && git clone #{image_url}")
SyncLog.sync_log("========check_clone:====cd #{path} && git clone #{image_url}===================")
SyncLog.sync_log("========check_clone:====cd #{path} && git clone #{image_url}=====success?:#{check_clone}==============")
if check_clone
SyncLog.sync_project_log("========gitlab_branches:#{gitlab_branches}===================")
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}")
gitlab_branches.each do |branch|


Loading…
Cancel
Save