Commit d02b139c authored by Chris Rohr's avatar Chris Rohr

Adding in ability to check status of automatic branch jobs in jenkins

Added change to change log
parent 33dce2df
...@@ -5,6 +5,7 @@ v 7.12 (Unreleased) ...@@ -5,6 +5,7 @@ v 7.12 (Unreleased)
- Prevent LDAP group sync from removing a group's last owner - Prevent LDAP group sync from removing a group's last owner
- Add Git hook to validate maximum file size. - Add Git hook to validate maximum file size.
- Project setting: approve merge request by N users before accept - Project setting: approve merge request by N users before accept
- Support automatic branch jobs created by Jenkins in CI Status
v 7.11.4 v 7.11.4
- no changes specific to EE - no changes specific to EE
......
...@@ -51,16 +51,17 @@ class JenkinsService < CiService ...@@ -51,16 +51,17 @@ class JenkinsService < CiService
end end
def build_page(sha, ref = nil) def build_page(sha, ref = nil)
project_url + "/scm/bySHA1/#{sha}" base_url = ref.nil? || ref == 'master' ? project_url : "#{project_url}_#{ref}"
base_url + "/scm/bySHA1/#{sha}"
end end
def commit_status(sha, ref = nil) def commit_status(sha, ref = nil)
parsed_url = URI.parse(build_page(sha)) parsed_url = URI.parse(build_page(sha, ref))
if parsed_url.userinfo.blank? if parsed_url.userinfo.blank?
response = HTTParty.get(build_page(sha), verify: false) response = HTTParty.get(build_page(sha, ref), verify: false)
else else
get_url = build_page(sha).gsub("#{parsed_url.userinfo}@", "") get_url = build_page(sha, ref).gsub("#{parsed_url.userinfo}@", "")
auth = { auth = {
username: URI.decode(parsed_url.user), username: URI.decode(parsed_url.user),
password: URI.decode(parsed_url.password), password: URI.decode(parsed_url.password),
......
...@@ -51,5 +51,9 @@ eos ...@@ -51,5 +51,9 @@ eos
describe :build_page do describe :build_page do
it { expect(@service.build_page("2ab7834c", 'master')).to eq("http://jenkins.gitlab.org/projects/2/scm/bySHA1/2ab7834c") } it { expect(@service.build_page("2ab7834c", 'master')).to eq("http://jenkins.gitlab.org/projects/2/scm/bySHA1/2ab7834c") }
end end
describe :build_page_with_branch do
it { expect(@service.build_page("2ab7834c", 'test_branch')).to eq("http://jenkins.gitlab.org/projects/2_test_branch/scm/bySHA1/2ab7834c") }
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment