diff options
author | Charles May <ctmay4@gmail.com> | 2016-01-05 21:26:31 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-04-12 18:08:05 +0200 |
commit | 061370790e415361c920e1404063955f4932e5ef (patch) | |
tree | 23a8f3985f6519cbe7be31cc36a194883f25ca27 | |
parent | 4087bd16e8e083550d306fd0c90d2a892b8577bf (diff) | |
download | gitlab-ce-061370790e415361c920e1404063955f4932e5ef.tar.gz |
Fix a bug with trailing slash in teamcity_url
See https://gitlab.com/gitlab-org/gitlab-ce/issues/3515
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | app/models/project_services/teamcity_service.rb | 31 |
2 files changed, 21 insertions, 13 deletions
diff --git a/CHANGELOG b/CHANGELOG index 3561c541df0..c6ca0ea3de1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -123,6 +123,9 @@ v 8.6.0 - Add information about `image` and `services` field at `job` level in the `.gitlab-ci.yml` documentation (Pat Turner) - HTTP error pages work independently from location and config (Artem Sidorenko) - Update `omniauth-saml` to 1.5.0 to allow for custom response attributes to be set + - Fix avatar stretching by providing a cropping feature (Johann Pardanaud) + - Fix a bug whith trailing slash in teamcity_url (Charles May) + - Don't load all of GitLab in mail_room - Memoize @group in Admin::GroupsController (Yatish Mehta) - Indicate how much an MR diverged from the target branch (Pierre de La Morinerie) - Added omniauth-auth0 Gem (Daniel Carraro) diff --git a/app/models/project_services/teamcity_service.rb b/app/models/project_services/teamcity_service.rb index b8e9416131a..246c5eb4a82 100644 --- a/app/models/project_services/teamcity_service.rb +++ b/app/models/project_services/teamcity_service.rb @@ -85,13 +85,15 @@ class TeamcityService < CiService end def build_info(sha) - url = URI.parse("#{teamcity_url}/httpAuth/app/rest/builds/"\ - "branch:unspecified:any,number:#{sha}") + url = URI.join( + teamcity_url, + "/httpAuth/app/rest/builds/branch:unspecified:any,number:#{sha}" + ).to_s auth = { username: username, password: password, } - @response = HTTParty.get("#{url}", verify: false, basic_auth: auth) + @response = HTTParty.get(url, verify: false, basic_auth: auth) end def build_page(sha, ref) @@ -100,12 +102,14 @@ class TeamcityService < CiService if @response.code != 200 # If actual build link can't be determined, # send user to build summary page. - "#{teamcity_url}/viewLog.html?buildTypeId=#{build_type}" + URI.join(teamcity_url, "/viewLog.html?buildTypeId=#{build_type}").to_s else # If actual build link is available, go to build result page. built_id = @response['build']['id'] - "#{teamcity_url}/viewLog.html?buildId=#{built_id}"\ - "&buildTypeId=#{build_type}" + URI.join( + teamcity_url, + "#{teamcity_url}/viewLog.html?buildId=#{built_id}&buildTypeId=#{build_type}" + ).to_s end end @@ -140,12 +144,13 @@ class TeamcityService < CiService branch = Gitlab::Git.ref_name(data[:ref]) - self.class.post("#{teamcity_url}/httpAuth/app/rest/buildQueue", - body: "<build branchName=\"#{branch}\">"\ - "<buildType id=\"#{build_type}\"/>"\ - '</build>', - headers: { 'Content-type' => 'application/xml' }, - basic_auth: auth - ) + self.class.post( + URI.join(teamcity_url, "/httpAuth/app/rest/buildQueue").to_s, + body: "<build branchName=\"#{branch}\">"\ + "<buildType id=\"#{build_type}\"/>"\ + '</build>', + headers: { 'Content-type' => 'application/xml' }, + basic_auth: auth + ) end end |