针对某些项目进行测试

This commit is contained in:
huang 2018-06-07 17:14:53 +08:00
parent edd777aacc
commit dc41da89c4
4 changed files with 1434 additions and 177 deletions

View File

@ -97,12 +97,13 @@ class PullRequestsController < ApplicationController
job_name = Time.now.to_i
# 如果分支有改动
if compare_pull_request(source_branch, target_project_id, target_branch)
# 自动生成配置Jenkinsjob在merge事件的时候触发jenkins、sonar
# merge发送的时候还没有接收所以分析对象应该源项目
exec_jenkins(source_branch, @project.gpid, git_url, job_name)
qa = QualityAnalysis.create(:project_id => @project.id, :author_login => User.current.login, :sonar_version => 1, :path => "./",
:branch => source_branch, :language => "java", :sonar_name => "#{job_name}")
if @project.try(:id).to_i == 4665
# 自动生成配置Jenkinsjob在merge事件的时候触发jenkins、sonar
# merge发送的时候还没有接收所以分析对象应该源项目
exec_jenkins(source_branch, @project.gpid, git_url, job_name)
qa = QualityAnalysis.create(:project_id => @project.id, :author_login => User.current.login, :sonar_version => 1, :path => "./",
:branch => source_branch, :language => "java", :sonar_name => "#{job_name}")
end
# 如果传送了目标项目ID即向fork源项目发送请求
# if params[:forked_project_id] && params[:source_project] == "forked_project_name"
@ -125,7 +126,9 @@ class PullRequestsController < ApplicationController
format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)}
end
end
qa.update_attribute(:pull_request_id, pr.id)
if @project.try(:id).to_i == 4665
qa.update_attribute(:pull_request_id, pr.id)
end
else
tip = 1
respond_to do |format|

View File

@ -1,5 +1,5 @@
class QualityAnalysis < ActiveRecord::Base
attr_accessible :author_login, :project_id, :rep_identifier, :sonar_version, :branch, :path, :rep_identifier, :language, :sonar_name
attr_accessible :author_login, :project_id, :rep_identifier, :sonar_version, :branch, :path, :rep_identifier, :language, :sonar_name, :pull_request_id
def user_rep_name
self.author_login+":"+self.rep_identifier

View File

@ -0,0 +1,5 @@
class AddPullRequestIdToQualityAnalyses < ActiveRecord::Migration
def change
add_column :quality_analyses, :pull_request_id, :integer
end
end

File diff suppressed because it is too large Load Diff