diff --git a/app/cli/automate.py b/app/cli/automate.py index 82635b4..c1de03b 100644 --- a/app/cli/automate.py +++ b/app/cli/automate.py @@ -11,6 +11,7 @@ from app.models.automation import Automation, AutomationState, AutomationLogs from app.terraform import BaseAutomation from app.terraform.block.bridge_dnsc import BlockBridgeDnscAutomation from app.terraform.block.bridge_github import BlockBridgeGitHubAutomation +from app.terraform.block.bridge_gitlab import BlockBridgeGitlabAutomation from app.terraform.block_external import BlockExternalAutomation from app.terraform.block_ooni import BlockOONIAutomation from app.terraform.block_roskomsvoboda import BlockRoskomsvobodaAutomation @@ -41,6 +42,7 @@ jobs = { AlarmSmartAwsAutomation, BlockBridgeDnscAutomation, BlockBridgeGitHubAutomation, + BlockBridgeGitlabAutomation, BlockExternalAutomation, BlockOONIAutomation, BlockRoskomsvobodaAutomation, diff --git a/app/terraform/block/bridge_gitlab.py b/app/terraform/block/bridge_gitlab.py index 7930669..8f2f2c1 100644 --- a/app/terraform/block/bridge_gitlab.py +++ b/app/terraform/block/bridge_gitlab.py @@ -18,10 +18,12 @@ class BlockBridgeGitlabAutomation(BlockBridgeReachabilityAutomation): if "GITLAB_URL" in current_app.config: credentials['url'] = current_app.config['GITLAB_URL'] gitlab = Gitlab(**credentials) - project = gitlab.project.get(current_app.config['GITLAB_BRIDGE_PROJECT']) + project = gitlab.projects.get(current_app.config['GITLAB_BRIDGE_PROJECT']) for vantage_point in current_app.config['GITHUB_BRIDGE_VANTAGE_POINTS']: - contents = project.get( - filepath=f"recentResult_{vantage_point}", + contents = project.files.get( + file_path=f"recentResult_{vantage_point}", ref=current_app.config["GITLAB_BRIDGE_BRANCH"] ) - self._lines = contents.decode().splitlines() + # Decode the base64 first, then decode the UTF-8 string + self._lines = contents.decode().decode('utf-8').splitlines() + diff --git a/app/terraform/list/gitlab.py b/app/terraform/list/gitlab.py index d5d6da6..9dd48f5 100644 --- a/app/terraform/list/gitlab.py +++ b/app/terraform/list/gitlab.py @@ -23,14 +23,14 @@ class ListGitlabAutomation(ListAutomation): gitlab = { source = "gitlabhq/gitlab" version = "~> 3.14.0" - {% if gitlab_url %} - url = "{{ gitlab_url }}" - {% endif %} } } } provider "gitlab" { + {% if gitlab_url %} + base_url = "{{ gitlab_url }}/api/v4/" + {% endif %} token = "{{ gitlab_token }}" }