gitlab: enterprise gitlab support
This commit is contained in:
parent
3163286e88
commit
63c36dccd2
3 changed files with 38 additions and 0 deletions
27
app/terraform/block/bridge_gitlab.py
Normal file
27
app/terraform/block/bridge_gitlab.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from flask import current_app
|
||||
from gitlab import Gitlab
|
||||
|
||||
from app.terraform.block.bridge_reachability import BlockBridgeReachabilityAutomation
|
||||
|
||||
|
||||
class BlockBridgeGitlabAutomation(BlockBridgeReachabilityAutomation):
|
||||
"""
|
||||
Automation task to import bridge reachability results from Gitlab.
|
||||
"""
|
||||
|
||||
short_name = "block_bridge_gitlab"
|
||||
description = "Import bridge reachability results from Gitlab"
|
||||
frequency = 30
|
||||
|
||||
def fetch(self) -> None:
|
||||
credentials = {"private_token": current_app.config['GITLAB_TOKEN']}
|
||||
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'])
|
||||
for vantage_point in current_app.config['GITHUB_BRIDGE_VANTAGE_POINTS']:
|
||||
contents = project.get(
|
||||
filepath=f"recentResult_{vantage_point}",
|
||||
ref=current_app.config["GITLAB_BRIDGE_BRANCH"]
|
||||
)
|
||||
self._lines = contents.decode().splitlines()
|
|
@ -1,3 +1,5 @@
|
|||
from flask import current_app
|
||||
|
||||
from app.terraform.list import ListAutomation
|
||||
|
||||
|
||||
|
@ -21,6 +23,9 @@ class ListGitlabAutomation(ListAutomation):
|
|||
gitlab = {
|
||||
source = "gitlabhq/gitlab"
|
||||
version = "~> 3.14.0"
|
||||
{% if gitlab_url %}
|
||||
url = "{{ gitlab_url }}"
|
||||
{% endif %}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,3 +51,8 @@ class ListGitlabAutomation(ListAutomation):
|
|||
|
||||
{% endfor %}
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
if current_app.config['GITLAB_URL']:
|
||||
self.template_parameters.append("gitlab_url")
|
||||
|
|
|
@ -21,3 +21,4 @@ sqlalchemy
|
|||
tldextract
|
||||
wtforms
|
||||
pyyaml
|
||||
python-gitlab
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue