From 8e0d8b2dd57602303db49b7151a2e4179dd2d2a2 Mon Sep 17 00:00:00 2001 From: apollorion Date: Thu, 1 Aug 2024 16:48:26 -0400 Subject: [PATCH 1/3] feat: support gitlab --- spacemk/exporters/terraform.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spacemk/exporters/terraform.py b/spacemk/exporters/terraform.py index e33add1..3215f91 100644 --- a/spacemk/exporters/terraform.py +++ b/spacemk/exporters/terraform.py @@ -1266,6 +1266,8 @@ def find_workspace_variable_with_invalid_name(data: dict, workspace_id: str, typ provider = "github_custom" elif provider == "bitbucket_server": provider = "bitbucket_datacenter" + elif provider == "gitlab_hosted": + provider = "gitlab" else: raise ValueError(f"Unknown VCS provider name ({provider})") From d0c3e3fe8e269b047b7c23a5eb47fdb60855d9f0 Mon Sep 17 00:00:00 2001 From: apollorion Date: Thu, 1 Aug 2024 16:58:46 -0400 Subject: [PATCH 2/3] feat: fix pylint error --- spacemk/exporters/terraform.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/spacemk/exporters/terraform.py b/spacemk/exporters/terraform.py index 3215f91..839fd0e 100644 --- a/spacemk/exporters/terraform.py +++ b/spacemk/exporters/terraform.py @@ -1258,16 +1258,21 @@ def find_workspace_variable_with_invalid_name(data: dict, workspace_id: str, typ ) provider = workspace.get("attributes.vcs-repo.service-provider") + + supported_providers = { + "github": "github_custom", + "github_app": "github_custom", + "github_enterprise": "github_custom", + "bitbucket_server": "bitbucket_datacenter", + "gitlab_hosted": "gitlab", + } + if provider is None: organization_name = workspace.get("relationships.organization.data.id") workspace_name = workspace.get("attributes.name") logging.warning(f"Workspace '{organization_name}/{workspace_name}' has no VCS configuration") - elif provider in ["github", "github_app", "github_enterprise"]: - provider = "github_custom" - elif provider == "bitbucket_server": - provider = "bitbucket_datacenter" - elif provider == "gitlab_hosted": - provider = "gitlab" + elif provider in supported_providers.keys(): + provider = supported_providers[provider] else: raise ValueError(f"Unknown VCS provider name ({provider})") From b36a656eee98040e49b27fe7ab0875bf08756e39 Mon Sep 17 00:00:00 2001 From: apollorion Date: Thu, 1 Aug 2024 17:01:28 -0400 Subject: [PATCH 3/3] fix: more pylint errors --- spacemk/exporters/terraform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacemk/exporters/terraform.py b/spacemk/exporters/terraform.py index 839fd0e..6b380b9 100644 --- a/spacemk/exporters/terraform.py +++ b/spacemk/exporters/terraform.py @@ -1271,7 +1271,7 @@ def find_workspace_variable_with_invalid_name(data: dict, workspace_id: str, typ organization_name = workspace.get("relationships.organization.data.id") workspace_name = workspace.get("attributes.name") logging.warning(f"Workspace '{organization_name}/{workspace_name}' has no VCS configuration") - elif provider in supported_providers.keys(): + elif provider in supported_providers: provider = supported_providers[provider] else: raise ValueError(f"Unknown VCS provider name ({provider})")