存储output结果
This commit is contained in:
parent
9e2070235f
commit
311f8855f4
|
@ -213,21 +213,23 @@ class PullRequestsController < ApplicationController
|
|||
# 获取jenkins输出结果
|
||||
def pr_console
|
||||
job_name = params[:job_name]
|
||||
pr = PullRequest.where(:pull_request_id => params[:pr_id]).first
|
||||
jenkins_address = Redmine::Configuration['jenkins_address']
|
||||
jenkins_username = Redmine::Configuration['jenkins_username']
|
||||
jenkins_password = Redmine::Configuration['jenkins_password']
|
||||
# connect jenkins
|
||||
client_jenkins = JenkinsApi::Client.new(:server_url => jenkins_address, :username => jenkins_username, :password => jenkins_password)
|
||||
@output = client_jenkins.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'html')["output"]
|
||||
@output2 = @output.gsub("\n", "\r\n")
|
||||
@output2 = @output.gsub("\n", "\r")
|
||||
@output3 = @output.gsub("\r\n", "\n")
|
||||
@output4 = @output.gsub("\r\n", "\r")
|
||||
@output5 = @output.gsub("\r", "\n")
|
||||
@output6 = @output.gsub("\r", "\r\n")
|
||||
@output7 = @output.gsub("\t", "\t\n")
|
||||
@output8 = @output.gsub("\t", "\n")
|
||||
@output9 = @output.gsub("\t", "\r")
|
||||
pr.update_column(:jenkins_output, @output)
|
||||
# @output2 = @output.gsub("\n", "\r\n")
|
||||
# @output2 = @output.gsub("\n", "\r")
|
||||
# @output3 = @output.gsub("\r\n", "\n")
|
||||
# @output4 = @output.gsub("\r\n", "\r")
|
||||
# @output5 = @output.gsub("\r", "\n")
|
||||
# @output6 = @output.gsub("\r", "\r\n")
|
||||
# @output7 = @output.gsub("\t", "\t\n")
|
||||
# @output8 = @output.gsub("\t", "\n")
|
||||
# @output9 = @output.gsub("\t", "\r")
|
||||
logger.info("jenkins ###########################{@output}")
|
||||
logger.info("jenkins 1111111111111111111111111##{@output2}")
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<% qa = QualityAnalysis.where(:pull_request_id => request.id).first %>
|
||||
|
||||
<% if qa.present? %>
|
||||
<p class="fr"><%= link_to "执行过程", pr_console_project_pull_requests_path(:job_name => qa.sonar_name), :class => "linkBlue2 ml10 mr10", :target => "_blank" %></p>
|
||||
<p class="fr"><%= link_to "执行过程", pr_console_project_pull_requests_path(:job_name => qa.sonar_name, :pr_id => request.id), :class => "linkBlue2 ml10 mr10", :target => "_blank" %></p>
|
||||
<p class="fr"><a class="linkBlue2 ml10 mr10" href="http://sonar.trustie.net/dashboard/index/<%= qa.sonar_name %>" target="_blank">质量检测结果</a></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -3,51 +3,3 @@
|
|||
<%= @output.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
22222222222222
|
||||
<div class="clear new_roadmap_listbox">
|
||||
<div class="clear">
|
||||
<%= @output2.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
33333333333333
|
||||
<div class="clear new_roadmap_listbox">
|
||||
<div class="clear">
|
||||
<%= @output3.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
4444444444445
|
||||
<div class="clear new_roadmap_listbox">
|
||||
<div class="clear">
|
||||
<%= @output4.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear new_roadmap_listbox">
|
||||
<div class="clear">
|
||||
<%= @output5.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear new_roadmap_listbox">
|
||||
<div class="clear">
|
||||
<%= @output6.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear new_roadmap_listbox">
|
||||
<div class="clear">
|
||||
<%= @output6.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear new_roadmap_listbox">
|
||||
<div class="clear">
|
||||
<%= @output4.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear new_roadmap_listbox">
|
||||
<div class="clear">
|
||||
<%= @output8.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear new_roadmap_listbox">
|
||||
<div class="clear">
|
||||
<%= @output9.html_safe %>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,5 @@
|
|||
class AddJenkinsOutputToPullRequests < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :pull_requests, :jenkins_output, :longtext
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue