spcd/cd/projects.py
Marc Beninca 49c046cb3d
All checks were successful
/ job (push) Successful in 6m55s
split
2024-06-09 18:41:20 +02:00

25 lines
662 B
Python

from pathlib import Path
GROUP_AND_NAME = [
"GITHUB_REPOSITORY",
"CI_PROJECT_PATH",
]
SERVER_URL = [
"GITHUB_SERVER_URL",
"CI_SERVER_URL",
]
class Projects:
def __init__(self, environment) -> None:
self.environment = environment
# group, name
for variable in GROUP_AND_NAME:
if value := self.environment.get(variable, None):
path = Path(value)
self.group = path.parent
self.name = path.name
# url
for variable in SERVER_URL:
if value := self.environment.get(variable, None):
self.url = Path(value) / self.group