Loading src/features/gitlab.py +18 −2 Changes for src/features/gitlab.py: 18 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ from typing import List # Modules libraries from gitlab import Gitlab from gitlab.exceptions import GitlabListError from gitlab.exceptions import GitlabGetError, GitlabListError from gitlab.v4.objects import Group, Project # GitLabFeature class Loading Loading @@ -241,7 +241,23 @@ class GitLabFeature: result += ['Git LFS'] # Disable unused feature (CI/CD) if project.jobs_enabled and not project.jobs.list(get_all=False): try: if project.jobs.list(get_all=False): pass elif any('name' in item and item['name'] == '.gitlab-ci.yml' for item in project.repository_tree(get_all=True)): pass elif any('path_with_namespace' in item and item['path_with_namespace'] != project.path_with_namespace for item in self.__gitlab.http_get( f'/projects/{project.id}/job_token_scope/allowlist', get_all=True, )): pass else: assert False except (AssertionError, GitlabGetError, GitlabListError): if project.jobs_enabled: project.jobs_enabled = False result += ['CI/CD'] Loading Loading
src/features/gitlab.py +18 −2 Changes for src/features/gitlab.py: 18 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ from typing import List # Modules libraries from gitlab import Gitlab from gitlab.exceptions import GitlabListError from gitlab.exceptions import GitlabGetError, GitlabListError from gitlab.v4.objects import Group, Project # GitLabFeature class Loading Loading @@ -241,7 +241,23 @@ class GitLabFeature: result += ['Git LFS'] # Disable unused feature (CI/CD) if project.jobs_enabled and not project.jobs.list(get_all=False): try: if project.jobs.list(get_all=False): pass elif any('name' in item and item['name'] == '.gitlab-ci.yml' for item in project.repository_tree(get_all=True)): pass elif any('path_with_namespace' in item and item['path_with_namespace'] != project.path_with_namespace for item in self.__gitlab.http_get( f'/projects/{project.id}/job_token_scope/allowlist', get_all=True, )): pass else: assert False except (AssertionError, GitlabGetError, GitlabListError): if project.jobs_enabled: project.jobs_enabled = False result += ['CI/CD'] Loading