Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

import sys

from github_actions.common import AllowEnvironments
from github_actions.common import Credentials
from github_actions.common import ExtendedEnvironmentSelector
from github_actions.common import GitHubContext
from github_actions.common import ProjectInitializer, GETTenant
from github_actions.common import RMKInstaller

from src.actions.actions import RMKCLIExecutor
from src.actions.init_project import ProjectInitializer, GETTenant
from src.credentials.cluster_provider_credentials import Credentials
from src.input_output.input import ArgumentParser
from src.select_environment.allowed_environments import AllowEnvironments
from src.select_environment.select_environment import ExtendedEnvironmentSelector
from src.utils.github_environment_variables import GitHubContext
from src.utils.install_rmk import RMKInstaller
from src.input_output.input import GitLabflowCDArgumentParser

if __name__ == "__main__":
try:
"""Parse command-line arguments"""
args = ArgumentParser().parse_args()
args = GitLabflowCDArgumentParser().parse_args()

"""Retrieve GitHub Action environment variables"""
github_context = GitHubContext.from_env(
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ GitPython~=3.1.44
PyGithub~=2.5.0
slack_sdk~=3.34.0
packaging~=24.2

git+https://github.com/edenlabllc/github_actions.common.git@v1#egg=github_actions.common
8 changes: 4 additions & 4 deletions src/actions/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from collections import defaultdict
from git import Repo

from ..input_output.output import GitHubOutput
from ..utils.cmd import BaseCommand, CMDInterface
from ..utils.github_environment_variables import GitHubContext
from github_actions.common import GitHubOutput
from github_actions.common import BaseCommand, CMDInterface
from github_actions.common import GitHubContext


class DestroyCommand(BaseCommand):
Expand Down Expand Up @@ -162,7 +162,7 @@ def _normalize_error_block(block: list) -> str:

@staticmethod
def _capi_controller_name_prefix(provider: str) -> str | None:
return {"aws":"capa", "azure":"capz", "gcp":"capg"}.get(provider)
return {"aws": "capa", "azure": "capz", "gcp": "capg"}.get(provider)

def _get_capi_resources_info(self) -> str | None:
print("Fetching all Cluster API (CAPI) resources...")
Expand Down
78 changes: 0 additions & 78 deletions src/actions/init_project.py

This file was deleted.

139 changes: 0 additions & 139 deletions src/credentials/cluster_provider_credentials.py

This file was deleted.

24 changes: 2 additions & 22 deletions src/input_output/input.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
import os
import argparse
from github_actions.common.input_output.input import ArgumentParser


class ArgumentParser:
class EnvDefault(argparse.Action):
def __init__(self, envvar, required=True, default=None, **kwargs):
if envvar:
if envvar in os.environ:
default = os.environ.get(envvar, default)
if required and default:
required = False
super(ArgumentParser.EnvDefault, self).__init__(default=default, required=required, metavar=envvar, **kwargs)

def __call__(self, parser, namespace, values, option_string=None):
setattr(namespace, self.dest, values)

def __init__(self):
self.parser = argparse.ArgumentParser()
self.setup_arguments()

class GitLabflowCDArgumentParser(ArgumentParser):
def setup_arguments(self):
self.parser.add_argument("--allowed-environments",
action=self.EnvDefault, envvar="INPUT_ALLOWED_ENVIRONMENTS",
Expand Down Expand Up @@ -95,6 +78,3 @@ def setup_arguments(self):
self.parser.add_argument("--rmk-version",
action=self.EnvDefault, envvar="INPUT_RMK_VERSION",
type=str, default='latest')

def parse_args(self):
return self.parser.parse_args()
14 changes: 0 additions & 14 deletions src/input_output/output.py

This file was deleted.

74 changes: 0 additions & 74 deletions src/notification/slack_notification.py

This file was deleted.

Loading