From b5206d250ad264492292659f7935b77690aa4642 Mon Sep 17 00:00:00 2001 From: benpankow Date: Tue, 7 May 2024 11:11:45 -0700 Subject: [PATCH] gitlab --- .../dagster/_core/definitions/metadata/source_code.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python_modules/dagster/dagster/_core/definitions/metadata/source_code.py b/python_modules/dagster/dagster/_core/definitions/metadata/source_code.py index 2ec3dc8d938b6..f915f6d670368 100644 --- a/python_modules/dagster/dagster/_core/definitions/metadata/source_code.py +++ b/python_modules/dagster/dagster/_core/definitions/metadata/source_code.py @@ -204,6 +204,10 @@ def _build_github_url(url: str, branch: str) -> str: return f"{url}/tree/{branch}" +def _build_gitlab_url(url: str, branch: str) -> str: + return f"{url}/-/tree/{branch}" + + @experimental def link_to_source_control( assets_defs: Sequence[Union["AssetsDefinition", "SourceAsset", "CacheableAssetsDefinition"]], @@ -211,7 +215,10 @@ def link_to_source_control( source_control_branch: str, repository_root_absolute_path: Union[Path, str], ) -> Sequence[Union["AssetsDefinition", "SourceAsset", "CacheableAssetsDefinition"]]: - if source_control_url and "github.com/" in source_control_url: + if "gitlab.com" in source_control_url: + source_control_url = _build_gitlab_url(source_control_url, source_control_branch) + else: + # assume GitHub URL scheme source_control_url = _build_github_url(source_control_url, source_control_branch) return [