msg 解码; 传gitUrl

This commit is contained in:
huang 2017-02-26 20:37:02 +08:00
parent 4127022891
commit aec9a1dcce
1 changed files with 6 additions and 2 deletions

View File

@ -886,8 +886,12 @@ class ProjectsController < ApplicationController
jobName = @project.forked_from_project_id jobName = @project.forked_from_project_id
@training_task = TrainingTask.find(taskId) @training_task = TrainingTask.find(taskId)
step = @training_task.position step = @training_task.position
original_project = Project.find(jobName)
rep_identify = Repository.where(:project_id => jobName, :type => "Repository::Gitlab").first.try(:identifier)
gitlab_address = Redmine::Configuration['gitlab_address']
gitUrl = gitlab_address.to_s+"/"+original_project.owner.to_s+"/"+ rep_identify + "."+"git"
if @training_task.status == 0 if @training_task.status == 0
params = {:jobName => "#{jobName}", :taskId => "#{taskId}", :step => "#{step}"} params = {:jobName => "#{jobName}", :taskId => "#{taskId}", :step => "#{step}", :gitUrl => "#{gitUrl}"}
uri = URI.parse("http://123.59.135.74:9999/jenkins-exec/api/buildJob") uri = URI.parse("http://123.59.135.74:9999/jenkins-exec/api/buildJob")
begin begin
res = uri_exec uri, params res = uri_exec uri, params
@ -939,7 +943,7 @@ class ProjectsController < ApplicationController
def training_task_status def training_task_status
status = params[:status].to_i status = params[:status].to_i
task_id = params[:taskId] task_id = params[:taskId]
message = params[:msg] message = Base64.decode64(params[:msg])
begin begin
@training_task = TrainingTask.find(task_id) @training_task = TrainingTask.find(task_id)
# 如果已经执行成功过,则不重复执行 # 如果已经执行成功过,则不重复执行