Commit cab0217522fb5862e9ea05bd84a68d81b4ec23cb

Authored by Victor Costa
1 parent e1f5af1a

serpro_integration: fix jenkins integration

plugins/serpro_integration/lib/ext/profile.rb
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -require_dependency 'profile'  
2 -  
3 -class Profile  
4 - settings_items :allow_sonar_integration, :type => :boolean, :default => false  
5 - settings_items :allow_gitlab_integration, :type => :boolean, :default => false  
6 -  
7 - #FIXME make test for default option  
8 - settings_items :serpro_integration_plugin, :type => Hash, :default => {}  
9 -end  
plugins/serpro_integration/lib/serpro_integration_plugin/jenkins_integration.rb
@@ -10,15 +10,14 @@ class SerproIntegrationPlugin::JenkinsIntegration @@ -10,15 +10,14 @@ class SerproIntegrationPlugin::JenkinsIntegration
10 end 10 end
11 11
12 def project_url 12 def project_url
13 - "#{jenkins_host}/#{jenkins_project_name}" 13 + "#{@profile.jenkins_host}/#{@profile.jenkins_project_name}"
14 end 14 end
15 15
16 #FIXME make jenkins integration works 16 #FIXME make jenkins integration works
17 def create_jenkis_project(profile, repository_path, web_url, git_url) 17 def create_jenkis_project(profile, repository_path, web_url, git_url)
18 @profile = profile 18 @profile = profile
19 #begin 19 #begin
20 - project_name = repository_path.split('/').last  
21 - if @client.job.list(project_name).blank? 20 + if @client.job.list(profile.jenkins_project_name).blank?
22 @client.job.create(profile.jenkins_project_name, xml_jenkins(repository_path, web_url, git_url)) 21 @client.job.create(profile.jenkins_project_name, xml_jenkins(repository_path, web_url, git_url))
23 end 22 end
24 #rescue JenkinsApi::Exceptions::ApiException 23 #rescue JenkinsApi::Exceptions::ApiException