change branches
This commit is contained in:
parent
5f4dc22625
commit
f820250ad0
|
@ -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…
Reference in New Issue