Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows GitLab SSH URLs on pack actions #5050

Merged
merged 11 commits into from
Jan 22, 2021
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ in development
Added
~~~~~

* Added support for GitLab SSH URLs on pack install and download actions. (improvement) #5050
Contributed by @asthLucas

* Added st2-rbac-backend pip requirements for RBAC integration. (new feature) #5086
Contributed by @hnanchahal

Expand Down
5 changes: 2 additions & 3 deletions st2common/st2common/util/pack_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,11 @@ def get_repo_url(pack, proxy_config=None):

def eval_repo_url(repo_url):
"""
Allow passing short GitHub style URLs.
Allow passing short GitHub or GitLab SSH style URLs.
"""
if not repo_url:
raise Exception('No valid repo_url provided or could be inferred.')

if repo_url.startswith("file://"):
if repo_url.startswith("gitlab@") or repo_url.startswith("file://"):
return repo_url
else:
if len(repo_url.split('/')) == 2 and 'git@' not in repo_url:
Expand Down
3 changes: 3 additions & 0 deletions st2common/tests/unit/test_pack_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ def test_eval_repo(self):
result = eval_repo_url('git@github.com:StackStorm/st2contrib.git')
self.assertEqual(result, 'git@github.com:StackStorm/st2contrib.git')

result = eval_repo_url('gitlab@gitlab.com:StackStorm/st2contrib.git')
self.assertEqual(result, 'gitlab@gitlab.com:StackStorm/st2contrib.git')

repo_url = 'https://github.com/StackStorm/st2contrib.git'
result = eval_repo_url(repo_url)
self.assertEqual(result, repo_url)
Expand Down