gitlab: refined enterprise gitlab support
This commit is contained in:
parent
63c36dccd2
commit
ece9244966
3 changed files with 11 additions and 7 deletions
|
@ -11,6 +11,7 @@ from app.models.automation import Automation, AutomationState, AutomationLogs
|
||||||
from app.terraform import BaseAutomation
|
from app.terraform import BaseAutomation
|
||||||
from app.terraform.block.bridge_dnsc import BlockBridgeDnscAutomation
|
from app.terraform.block.bridge_dnsc import BlockBridgeDnscAutomation
|
||||||
from app.terraform.block.bridge_github import BlockBridgeGitHubAutomation
|
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_external import BlockExternalAutomation
|
||||||
from app.terraform.block_ooni import BlockOONIAutomation
|
from app.terraform.block_ooni import BlockOONIAutomation
|
||||||
from app.terraform.block_roskomsvoboda import BlockRoskomsvobodaAutomation
|
from app.terraform.block_roskomsvoboda import BlockRoskomsvobodaAutomation
|
||||||
|
@ -41,6 +42,7 @@ jobs = {
|
||||||
AlarmSmartAwsAutomation,
|
AlarmSmartAwsAutomation,
|
||||||
BlockBridgeDnscAutomation,
|
BlockBridgeDnscAutomation,
|
||||||
BlockBridgeGitHubAutomation,
|
BlockBridgeGitHubAutomation,
|
||||||
|
BlockBridgeGitlabAutomation,
|
||||||
BlockExternalAutomation,
|
BlockExternalAutomation,
|
||||||
BlockOONIAutomation,
|
BlockOONIAutomation,
|
||||||
BlockRoskomsvobodaAutomation,
|
BlockRoskomsvobodaAutomation,
|
||||||
|
|
|
@ -18,10 +18,12 @@ class BlockBridgeGitlabAutomation(BlockBridgeReachabilityAutomation):
|
||||||
if "GITLAB_URL" in current_app.config:
|
if "GITLAB_URL" in current_app.config:
|
||||||
credentials['url'] = current_app.config['GITLAB_URL']
|
credentials['url'] = current_app.config['GITLAB_URL']
|
||||||
gitlab = Gitlab(**credentials)
|
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']:
|
for vantage_point in current_app.config['GITHUB_BRIDGE_VANTAGE_POINTS']:
|
||||||
contents = project.get(
|
contents = project.files.get(
|
||||||
filepath=f"recentResult_{vantage_point}",
|
file_path=f"recentResult_{vantage_point}",
|
||||||
ref=current_app.config["GITLAB_BRIDGE_BRANCH"]
|
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()
|
||||||
|
|
||||||
|
|
|
@ -23,14 +23,14 @@ class ListGitlabAutomation(ListAutomation):
|
||||||
gitlab = {
|
gitlab = {
|
||||||
source = "gitlabhq/gitlab"
|
source = "gitlabhq/gitlab"
|
||||||
version = "~> 3.14.0"
|
version = "~> 3.14.0"
|
||||||
{% if gitlab_url %}
|
|
||||||
url = "{{ gitlab_url }}"
|
|
||||||
{% endif %}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "gitlab" {
|
provider "gitlab" {
|
||||||
|
{% if gitlab_url %}
|
||||||
|
base_url = "{{ gitlab_url }}/api/v4/"
|
||||||
|
{% endif %}
|
||||||
token = "{{ gitlab_token }}"
|
token = "{{ gitlab_token }}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue