Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
huang 2017-02-28 09:56:13 +08:00
commit 5740204301
1 changed files with 8 additions and 4 deletions

View File

@ -890,8 +890,13 @@ class ProjectsController < ApplicationController
jobName = @project.forked_from_project_id
@training_task = TrainingTask.find(taskId)
step = @training_task.position
rep_identify = Repository.where(:project_id => @project.id, :type => "Repository::Gitlab").first.try(:identifier)
gitlab_address = Redmine::Configuration['gitlab_address']
gitUrl = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ rep_identify + "."+"git"
gitUrl = Base64.encode64(gitUrl)
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")
begin
res = uri_exec uri, params
@ -943,7 +948,7 @@ class ProjectsController < ApplicationController
def training_task_status
status = params[:status].to_i
task_id = params[:taskId]
message = params[:msg]
message = Base64.decode64(params[:msg])
begin
@training_task = TrainingTask.find(task_id)
# 如果已经执行成功过,则不重复执行
@ -960,8 +965,7 @@ class ProjectsController < ApplicationController
ActiveRecord::Base.transaction do
if position < original_tasks_count
# 继续发布下一个任务
position = position + 1
publish_training_tasks original_project_id, @training_task.project_id, position
publish_training_tasks original_project_id, @training_task.project_id, position + 1
end
@training_task.update_attribute(:status, 1)
# 创建一条回复提醒