Commit c1a8d2c0 authored by Adrian DC's avatar Adrian DC
Browse files

fix(entrypoint): detect if GitLab actions can continue

Signed-off-by: default avatarAdrian DC <radian.dc@gmail.com>
parent 005b50c1
Loading
Loading
Loading
Loading
Loading
+27 −13
Changes for src/cli/entrypoint.py: 27 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ from ..types.namespaces import Namespaces
# Entrypoint class, pylint: disable=too-few-public-methods
class Entrypoint:

    # CLI
    # CLI, pylint: disable=too-many-branches
    @staticmethod
    def cli(options: Namespace) -> bool:

@@ -109,14 +109,17 @@ class Entrypoint:

            # Handle group if missing
            if not options.exclude_group:
                Entrypoint.group(
                if not Entrypoint.group(
                        options,
                        input_gitlab,
                        output_gitlab,
                        input_group.id,
                        options.output_group,
                        migration=not output_exists,
                )
                ):
                    return False

                # Acquire output group
                output_group = output_gitlab.group(options.output_group, optional=True)

            # Iterate through subgroups
@@ -130,7 +133,7 @@ class Entrypoint:
                        ),
                        key=lambda item: item.full_path,
                ):
                    Entrypoint.subgroup(
                    if not Entrypoint.subgroup(
                            options,
                            input_gitlab,
                            output_gitlab,
@@ -138,7 +141,8 @@ class Entrypoint:
                            input_subgroup.id,
                            output_group.id,
                            migration=output_exists,
                    )
                    ):
                        return False

            # Iterate through projects
            if not options.exclude_projects:
@@ -151,14 +155,15 @@ class Entrypoint:
                        ),
                        key=lambda item: item.path_with_namespace,
                ):
                    Entrypoint.project(
                    if not Entrypoint.project(
                            options,
                            input_gitlab,
                            output_gitlab,
                            input_project.id,
                            input_group.id,
                            output_group.id,
                    )
                    ):
                        return False

        # Result
        return True
@@ -172,7 +177,7 @@ class Entrypoint:
        criteria_input_group: str,
        criteria_output_group: str,
        migration: bool = True,
    ) -> None:
    ) -> bool:

        # Acquire input group
        input_group = input_gitlab.group(criteria_input_group)
@@ -202,7 +207,7 @@ class Entrypoint:
                  f'{Colors.RESET}')
            print(' ')
            Platform.flush()
            return
            return True

        # Export group
        print(f'{Colors.BOLD}   - Exporting from: '
@@ -269,6 +274,9 @@ class Entrypoint:
        print(' ')
        Platform.flush()

        # Result
        return True

    # Project, pylint: disable=too-many-arguments,too-many-branches,too-many-locals
    @staticmethod
    def project(
@@ -278,7 +286,7 @@ class Entrypoint:
        criteria_project: str,
        criteria_input_group: str,
        criteria_output_group: str,
    ) -> None:
    ) -> bool:

        # Acquire input project
        input_project = input_gitlab.project(criteria_project)
@@ -318,7 +326,7 @@ class Entrypoint:
                  f'{Colors.RESET}')
            print(' ')
            Platform.flush()
            return
            return True

        # Export project
        print(f'{Colors.BOLD}   - Exporting from: '
@@ -414,6 +422,9 @@ class Entrypoint:
        print(' ')
        Platform.flush()

        # Result
        return True

    # Subgroup, pylint: disable=too-many-arguments,too-many-statements
    @staticmethod
    def subgroup(
@@ -424,7 +435,7 @@ class Entrypoint:
        criteria_input_subgroup: str,
        criteria_output_group: str,
        migration: bool = True,
    ) -> None:
    ) -> bool:

        # Acquire input group
        input_group = input_gitlab.group(criteria_input_group)
@@ -473,7 +484,7 @@ class Entrypoint:
                      f'{Colors.RESET}')
                print(' ')
                Platform.flush()
                return
                return True

            # Export subgroup
            print(f'{Colors.BOLD}   - Exporting from: '
@@ -560,3 +571,6 @@ class Entrypoint:
        # Footer
        print(' ')
        Platform.flush()

        # Result
        return True