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()
|
Loading…
Add table
Add a link
Reference in a new issue