diff --git a/PHPCI/Model/Build/GitlabBuild.php b/PHPCI/Model/Build/GitlabBuild.php index 83053090..086bc046 100644 --- a/PHPCI/Model/Build/GitlabBuild.php +++ b/PHPCI/Model/Build/GitlabBuild.php @@ -61,7 +61,17 @@ class GitlabBuild extends RemoteGitBuild if (!empty($key)) { $user = $this->getProject()->getAccessInformation("user"); $domain = $this->getProject()->getAccessInformation("domain"); - return $user . '@' . $domain . ':' . $this->getProject()->getReference() . '.git'; + $port = $this->getProject()->getAccessInformation('port'); + + $url = $user . '@' . $domain . ':'; + + if (!empty($port)) { + $url .= $port . '/'; + } + + $url .= $this->getProject()->getReference() . '.git'; + + return $url; } } } diff --git a/PHPCI/Service/ProjectService.php b/PHPCI/Service/ProjectService.php index 04636e3a..1bc1b248 100644 --- a/PHPCI/Service/ProjectService.php +++ b/PHPCI/Service/ProjectService.php @@ -107,13 +107,18 @@ class ProjectService $matches = array(); $reference = $project->getReference(); - if ($project->getType() == 'gitlab' && preg_match('`^(.*)@(.*):(.*)/(.*)\.git`', $reference, $matches)) { + if ($project->getType() == 'gitlab') { $info = array(); - $info['user'] = $matches[1]; - $info['domain'] = $matches[2]; + + if (preg_match('`^(.*)@(.*):([0-9]+)?/?(.*)/(.*)\.git`', $reference, $matches)) { + $info['user'] = $matches[1]; + $info['domain'] = $matches[2]; + $info['port'] = $matches[3]; + + $project->setReference($matches[4] . '/' . $matches[5]); + } $project->setAccessInformation($info); - $project->setReference($matches[3] . '/' . $matches[4]); } } }