diff --git a/CHANGELOG-EE b/CHANGELOG-EE index 459b857e09..a71fa8a6bd 100644 --- a/CHANGELOG-EE +++ b/CHANGELOG-EE @@ -2,7 +2,8 @@ v 7.14 - Disable adding, updating and removing members from a group that is synced with LDAP - Don't send "Added to group" notifications when group is LDAP synched - Fix importing projects from GitHub Enterprise Edition. - - Automatic approver suggestions (based on an authority of the code) + - Automatic approver suggestions (based on an authority of the code) + - Add support for Jenkins unstable status v7.13.3 - Merge community edition changes for version 7.13.3 @@ -21,7 +22,7 @@ v 7.13.1 v 7.13 - Fix git hook validation on initial push to master branch. - Reset approvals on push - - Fix 500 error when the source project of an MR is deleted + - Fix 500 error when the source project of an MR is deleted - Ability to define merge request approvers v 7.12.2 diff --git a/app/models/project_services/jenkins_service.rb b/app/models/project_services/jenkins_service.rb index e1ae9ff80d..2861c90709 100644 --- a/app/models/project_services/jenkins_service.rb +++ b/app/models/project_services/jenkins_service.rb @@ -72,7 +72,7 @@ class JenkinsService < CiService if response.code == 200 # img.build-caption-status-icon for old jenkins version src = Nokogiri.parse(response).css('img.build-caption-status-icon,.build-caption>img').first.attributes['src'].value - if src =~ /blue\.png$/ + if src =~ /(blue\.png|yellow\.png)$/ 'success' elsif src =~ /(red|aborted|yellow)\.png$/ 'failed' diff --git a/spec/models/project_services/jenkins_service_spec.rb b/spec/models/project_services/jenkins_service_spec.rb index 7a318ade80..5be43ac483 100644 --- a/spec/models/project_services/jenkins_service_spec.rb +++ b/spec/models/project_services/jenkins_service_spec.rb @@ -26,6 +26,15 @@ describe JenkinsService do end describe 'commits methods' do + def status_body_for_icon(state) + body =<Success + Build #188 + (Oct 15, 2014 9:45:21 PM) + +eos + end + before do @service = JenkinsService.new allow(@service).to receive_messages( @@ -33,19 +42,16 @@ describe JenkinsService do project_url: 'http://jenkins.gitlab.org/projects/2', token: 'verySecret' ) - - body =<Success - Build #188 - (Oct 15, 2014 9:45:21 PM) - -eos - stub_request(:get, "http://jenkins.gitlab.org/projects/2/scm/bySHA1/2ab7834c"). - to_return(status: 200, body: body, headers: {}) end describe :commit_status do - it { expect(@service.commit_status("2ab7834c", 'master')).to eq("success") } + statuses = {'blue.png' => 'success', 'yellow.png' => 'success', 'red.png' => 'failed', 'aborted.png' => 'failed', 'blue-anime.gif' => 'running', 'grey.png' => 'pending'} + statuses.each do |icon, state| + it "should have a status of #{state} when the icon #{icon} exists." do + stub_request(:get, "http://jenkins.gitlab.org/projects/2/scm/bySHA1/2ab7834c").to_return(status: 200, body: status_body_for_icon(icon), headers: {}) + expect(@service.commit_status("2ab7834c", 'master')).to eq(state) + end + end end describe :build_page do