2024-04-27 14:14:03 +00:00
|
|
|
from os import path
|
|
|
|
|
|
|
|
GROUP_AND_NAME = [
|
|
|
|
'GITHUB_REPOSITORY',
|
|
|
|
'CI_PROJECT_PATH',
|
|
|
|
]
|
|
|
|
SERVER_URL = [
|
|
|
|
'GITHUB_SERVER_URL',
|
|
|
|
'CI_SERVER_URL',
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2024-04-27 13:32:33 +00:00
|
|
|
class Projects:
|
|
|
|
def __init__(self, environment):
|
2024-04-27 15:09:51 +00:00
|
|
|
self.environment = environment
|
2024-04-27 14:14:03 +00:00
|
|
|
# group, name
|
|
|
|
for variable in GROUP_AND_NAME:
|
2024-04-27 15:09:51 +00:00
|
|
|
if value := self.environment.get(variable, None):
|
2024-04-27 14:14:03 +00:00
|
|
|
self.group, self.name = path.split(value)
|
|
|
|
# url
|
|
|
|
for variable in SERVER_URL:
|
2024-04-27 15:09:51 +00:00
|
|
|
if value := self.environment.get(variable, None):
|
2024-04-27 14:14:03 +00:00
|
|
|
self.url = path.join(value, self.group)
|