summaryrefslogtreecommitdiff
path: root/qa/qa
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-02-12 16:43:32 +0800
committerLin Jen-Shin <godfat@godfat.org>2018-02-12 16:43:32 +0800
commitbc2739a52ff9a5366d3d668ef0ee07e91974c540 (patch)
tree3feef5d1f12464d15c8c2140b32fc154f46d89ad /qa/qa
parent75984534f80b97d2bc7f05c24ce3e0cadb5b85a3 (diff)
downloadgitlab-ce-bc2739a52ff9a5366d3d668ef0ee07e91974c540.tar.gz
Adopt Git style URI
Diffstat (limited to 'qa/qa')
-rw-r--r--qa/qa/git/repository.rb14
-rw-r--r--qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb2
2 files changed, 15 insertions, 1 deletions
diff --git a/qa/qa/git/repository.rb b/qa/qa/git/repository.rb
index 8f999511d58..606fc66b4d5 100644
--- a/qa/qa/git/repository.rb
+++ b/qa/qa/git/repository.rb
@@ -1,3 +1,4 @@
+require 'cgi'
require 'uri'
module QA
@@ -5,6 +6,19 @@ module QA
class Repository
include Scenario::Actable
+ # See: config/initializers/1_settings.rb
+ # Settings#build_gitlab_shell_ssh_path_prefix
+ def self.parse_uri(git_uri)
+ if git_uri.start_with?('ssh://')
+ URI.parse(git_uri)
+ else
+ *rest, path = git_uri.split(':')
+ # Host cannot have : so we'll need to escape it
+ user_host = rest.join('%3A').sub(/\A\[(.+)\]\z/, '\1')
+ URI.parse("ssh://#{user_host}/#{path}")
+ end
+ end
+
def self.perform(*args)
Dir.mktmpdir do |dir|
Dir.chdir(dir) { super }
diff --git a/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb b/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb
index 39c600aee87..c1fa8d5b58a 100644
--- a/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb
+++ b/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb
@@ -45,7 +45,7 @@ module QA
repository_location
end
- repository_uri = URI.parse(repository_url)
+ repository_uri = Git::Repository.parse_uri(repository_url)
gitlab_ci =
<<~YAML